6 use Test::More 'no_plan';
8 use Scope::Upper qw/reap UP HERE/;
11 use Scope::Upper::TestGenerator;
13 local $Scope::Upper::TestGenerator::call = sub {
14 my ($height, $level, $i) = @_;
15 $level = $level ? 'UP ' x $level : 'HERE';
16 return [ "reap \\&check => $level;\n" ];
19 local $Scope::Upper::TestGenerator::test = sub {
20 my ($height, $level, $i, $x) = @_;
21 my $j = $i < $height - $level ? 0 : (defined $x ? $x : 'undef');
22 return "is(\$x, $j, 'x h=$height, l=$level, i=$i');\n";
25 local $Scope::Upper::TestGenerator::local = sub {
26 my ($height, $level, $i, $x) = @_;
27 return $i == $height - $level ? "\$x = $x;\n" : "local \$x = $x;\n";
30 local $Scope::Upper::TestGenerator::testlocal = sub { '' };
32 local $Scope::Upper::TestGenerator::allblocks = 1;
36 sub check { $x = (defined $x) ? ($x ? 0 : $x . 'x') : 0 }
39 no warnings 'redefine';
41 my ($a, $b, $desc) = @_;
43 and (defined $b) ? (not defined $a or $a != $b) : defined $a) {
45 === This testcase failed ===
47 ==== vvvvv Errors vvvvvv ===
51 Test::More::is($a, $b, $desc);
55 for my $level (0 .. 1) {
56 my $height = $level + 1;
57 my $tests = Scope::Upper::TestGenerator::gen($height, $level);