6 use Test::More 'no_plan';
8 use Scope::Upper qw/reap/;
11 use Scope::Upper::TestGenerator;
13 local $Scope::Upper::TestGenerator::call = sub {
14 my ($height, $level, $i) = @_;
15 return [ "reap \\&check => $level;\n" ];
18 local $Scope::Upper::TestGenerator::test = sub {
19 my ($height, $level, $i, $x) = @_;
20 my $j = $i < $height - $level ? 0 : (defined $x ? $x : 'undef');
21 return "is(\$x, $j, 'x h=$height, l=$level, i=$i');\n";
24 local $Scope::Upper::TestGenerator::local = sub {
25 my ($height, $level, $i, $x) = @_;
26 return $i == $height - $level ? "\$x = $x;\n" : "local \$x = $x;\n";
29 local $Scope::Upper::TestGenerator::testlocal = sub { '' };
31 local $Scope::Upper::TestGenerator::allblocks = 1;
35 sub check { $x = (defined $x) ? ($x ? 0 : $x . 'x') : 0 }
38 no warnings 'redefine';
40 my ($a, $b, $desc) = @_;
42 and (defined $b) ? (not defined $a or $a != $b) : defined $a) {
44 === This testcase failed ===
46 ==== vvvvv Errors vvvvvv ===
50 Test::More::is($a, $b, $desc);
54 for my $level (0 .. 1) {
55 my $height = $level + 1;
56 my $tests = Scope::Upper::TestGenerator::gen($height, $level);