6 use Test::More 'no_plan';
8 use Scope::Upper qw/unwind/;
10 our ($call, @args, $args);
13 my ($height, $level, $i) = @_;
14 return [ [ "unwind(\@args => $level)\n", '' ] ];
30 @blocks = map [ map "$_\n", @$_ ], @blocks;
31 @contexts = map [ map "$_\n", @$_ ], @contexts;
34 my ($height, $level, $i) = @_;
35 push @_, $i = 0 if @_ == 2;
37 my $up = $i == $height + 1 ? $call->(@_) : gen($height, $level, $i + 1);
38 if ($i + $level == $height + 1) {
40 $_->[1] = "return($args)\n";
44 my ($code, $exp) = @$base;
45 for my $blk (@blocks) {
46 for my $cx (@contexts) {
48 $blk->[0] . $cx->[0] . $code . $cx->[1] . $blk->[1],
49 $blk->[0] . $cx->[0] . $exp . $cx->[1] . $blk->[1],
51 my $list = join ', ', map { int rand 10 } 0 .. rand 3;
53 $blk->[0] . $cx->[0] . "($list, " . $code . ')' . $cx->[1] . $blk->[1],
54 $blk->[0] . $cx->[0] . "($list, " . $exp . ')' . $cx->[1] . $blk->[1],
66 my @res = eval $_->[0];
67 my @exp = eval $_->[1] unless $@;
68 if ($@ || !is_deeply \@res, \@exp) {
69 diag "=== vvv Test vvv ===";
71 diag "------- Got --------";
72 diag join(', ', map { defined($_) ? $_ : '(undef)' } @res);
73 diag "----- Expected -----";
74 diag join(', ', map { defined($_) ? $_ : '(undef)' } @exp);
75 diag "=== ^^^^^^^^^^^^ ===";
80 for ([ ], [ 'A' ], [ qw/B C/ ]) {
82 $args = '(' . join(', ', map "'$_'", @args) . ')';