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],
62 sub linearize { join ', ', map { defined($_) ? $_ : '(undef)' } @_ }
65 my ($height, $level) = @_;
71 my $res = linearize eval $_->[0];
72 $res = '*TEST DID NOT COMPILE*' if $@;
75 $exp = linearize eval $_->[1];
76 $exp = '*REFERENCE DID NOT COMPILE*' if $@;
78 if ($@ || $res ne $exp) {
80 === This testcase failed ===
82 ==== vvvvv Errors vvvvvv ===
85 is $res, $exp, "stress unwind $height $level $i";
89 for ([ ], [ 'A' ], [ qw/B C/ ]) {
91 $args = '(' . join(', ', map "'$_'", @args) . ')';