X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F85-stress-unwind.t;h=fa52bcd07b34eb83e22d7cf6505610298a5dda76;hb=7505ee1e658a27b68ebe24c52c1db86694251bb4;hp=75bad3e18dbefe98b3a409c4cb496d7d161cbfaf;hpb=f912774248aa5a4bf3727e5b0315fccf42b96bf3;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/85-stress-unwind.t b/t/85-stress-unwind.t index 75bad3e..fa52bcd 100644 --- a/t/85-stress-unwind.t +++ b/t/85-stress-unwind.t @@ -3,14 +3,16 @@ use strict; use warnings; -use Test::More 'no_plan'; +use lib 't/lib'; +use Test::Leaner 'no_plan'; -use Scope::Upper qw/unwind/; +use Scope::Upper qw; our ($call, @args, $args); $call = sub { my ($height, $level, $i) = @_; + $level = $level ? 'UP ' x $level : 'HERE'; return [ [ "unwind(\@args => $level)\n", '' ] ]; }; @@ -59,25 +61,34 @@ sub gen { return \@res; } +sub linearize { join ', ', map { defined($_) ? $_ : '(undef)' } @_ } + sub runtests { + my ($height, $level) = @_; + my $i; my $tests = gen @_; for (@$tests) { + ++$i; no warnings 'void'; - my @res = eval $_->[0]; - my @exp = eval $_->[1] unless $@; - if ($@ || !is_deeply \@res, \@exp) { - diag "=== vvv Test vvv ==="; - diag $_->[0]; - diag "------- Got --------"; - diag join(', ', map { defined($_) ? $_ : '(undef)' } @res); - diag "----- Expected -----"; - diag join(', ', map { defined($_) ? $_ : '(undef)' } @exp); - diag "=== ^^^^^^^^^^^^ ==="; + my $res = linearize eval $_->[0]; + $res = '*TEST DID NOT COMPILE*' if $@; + my $exp; + unless ($@) { + $exp = linearize eval $_->[1]; + $exp = '*REFERENCE DID NOT COMPILE*' if $@; + } + if ($@ || $res ne $exp) { + diag <[0]; +==== vvvvv Errors vvvvvv === +DIAG } + is $res, $exp, "stress unwind $height $level $i"; } } -for ([ ], [ 'A' ], [ qw/B C/ ]) { +for ([ ], [ 'A' ], [ qw ]) { @args = @$_; $args = '(' . join(', ', map "'$_'", @args) . ')'; runtests 0, 0;