6 use Test::More tests => 4 * 3;
11 use Scope::Upper qw<yield HERE>;
13 # Test timely destruction of values returned from yield()
16 sub guard { VPIT::TestHelpers::Guard->new(sub { ++$destroyed }) }
19 my $desc = 'scalar context, above';
24 is $destroyed, undef, "$desc: not yet destroyed 1";
28 is $destroyed, undef, "$desc: not yet destroyed 2";
30 is $destroyed, 1, "$desc: destroyed 1";
34 my $desc = 'scalar context, below';
39 is $destroyed, undef, "$desc: not yet destroyed 1";
43 is $destroyed, undef, "$desc: not yet destroyed 2";
45 is $destroyed, 1, "$desc: destroyed 1";
49 my $desc = 'void context, above';
54 is $destroyed, undef, "$desc: not yet destroyed 1";
58 is $destroyed, undef, "$desc: not yet destroyed 2";
60 is $destroyed, 1, "$desc: destroyed 1";
64 my $desc = 'void context, below';
68 is $destroyed, undef, "$desc: not yet destroyed 1";
73 is $destroyed, 1, "$desc: destroyed 1";
75 is $destroyed, 1, "$desc: destroyed 2";