6 use Test::More 'no_plan';
8 use Scope::Upper qw/unwind UP HERE/;
10 our ($call, @args, $args);
13 my ($height, $level, $i) = @_;
14 $level = $level ? 'UP ' x $level : 'HERE';
15 return [ [ "unwind(\@args => $level)\n", '' ] ];
31 @blocks = map [ map "$_\n", @$_ ], @blocks;
32 @contexts = map [ map "$_\n", @$_ ], @contexts;
35 my ($height, $level, $i) = @_;
36 push @_, $i = 0 if @_ == 2;
38 my $up = $i == $height + 1 ? $call->(@_) : gen($height, $level, $i + 1);
39 if ($i + $level == $height + 1) {
41 $_->[1] = "return($args)\n";
45 my ($code, $exp) = @$base;
46 for my $blk (@blocks) {
47 for my $cx (@contexts) {
49 $blk->[0] . $cx->[0] . $code . $cx->[1] . $blk->[1],
50 $blk->[0] . $cx->[0] . $exp . $cx->[1] . $blk->[1],
52 my $list = join ', ', map { int rand 10 } 0 .. rand 3;
54 $blk->[0] . $cx->[0] . "($list, " . $code . ')' . $cx->[1] . $blk->[1],
55 $blk->[0] . $cx->[0] . "($list, " . $exp . ')' . $cx->[1] . $blk->[1],
63 sub linearize { join ', ', map { defined($_) ? $_ : '(undef)' } @_ }
66 my ($height, $level) = @_;
72 my $res = linearize eval $_->[0];
73 $res = '*TEST DID NOT COMPILE*' if $@;
76 $exp = linearize eval $_->[1];
77 $exp = '*REFERENCE DID NOT COMPILE*' if $@;
79 if ($@ || $res ne $exp) {
81 === This testcase failed ===
83 ==== vvvvv Errors vvvvvv ===
86 is $res, $exp, "stress unwind $height $level $i";
90 for ([ ], [ 'A' ], [ qw/B C/ ]) {
92 $args = '(' . join(', ', map "'$_'", @args) . ')';