X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F32-localize_elem-block.t;h=82cabc7ce515fd2419c031a5c7484b7d30a8e0e0;hb=8aa5517d42b61e877ca7e4198f12ab879fa8218b;hp=f5a5147a2c21c02817b899a9d1d24a4e0b289edf;hpb=0a6221d3f467b5f819e3c119b4cda0218399cb51;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/32-localize_elem-block.t b/t/32-localize_elem-block.t index f5a5147..82cabc7 100644 --- a/t/32-localize_elem-block.t +++ b/t/32-localize_elem-block.t @@ -3,18 +3,18 @@ use strict; use warnings; -use Test::More 'no_plan'; +use lib 't/lib'; +use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize_elem UP HERE/; +use Scope::Upper qw; -use lib 't/lib'; use Scope::Upper::TestGenerator; -local $Scope::Upper::TestGenerator::testlocal = sub { '' }; +our $testcase; -local $Scope::Upper::TestGenerator::allblocks = 1; +local $Scope::Upper::TestGenerator::local_test = sub { '' }; -our $testcase; +local $Scope::Upper::TestGenerator::allblocks = 1; local $Scope::Upper::TestGenerator::call = sub { my ($height, $level, $i) = @_; @@ -25,23 +25,19 @@ local $Scope::Upper::TestGenerator::call = sub { local $Scope::Upper::TestGenerator::test = sub { my ($height, $level, $i, $x) = @_; my $j = ($i == $height - $level) ? 0 : (defined $x ? $x : 11); - return "is(\$a[1], $j, 'x h=$height, l=$level, i=$i');\n"; + return "verbose_is(\$a[1], $j, 'x h=$height, l=$level, i=$i');\n"; }; -local $Scope::Upper::TestGenerator::local = sub { - my $x = $_[3]; - return "local \$a[1] = $x;\n"; -}; +local $Scope::Upper::TestGenerator::local_var = '$a[1]'; our @a; for my $level (0 .. 1) { my $height = $level + 1; my $tests = Scope::Upper::TestGenerator::gen($height, $level); - for (@$tests) { - $testcase = $_; + for $testcase (@$tests) { @a = (10, 11); - eval; + eval $testcase; diag $@ if $@; } } @@ -55,23 +51,19 @@ local $Scope::Upper::TestGenerator::call = sub { local $Scope::Upper::TestGenerator::test = sub { my ($height, $level, $i, $x) = @_; my $j = ($i == $height - $level) ? 0 : (defined $x ? $x : 'undef'); - return "is(\$h{a}, $j, 'x h=$height, l=$level, i=$i');\n"; + return "verbose_is(\$h{a}, $j, 'x h=$height, l=$level, i=$i');\n"; }; -local $Scope::Upper::TestGenerator::local = sub { - my $x = $_[3]; - return "local \$h{a} = $x;\n"; -}; +local $Scope::Upper::TestGenerator::local_var = '$h{a}'; our %h; for my $level (0 .. 1) { my $height = $level + 1; my $tests = Scope::Upper::TestGenerator::gen($height, $level); - for (@$tests) { - $testcase = $_; + for $testcase (@$tests) { %h = (); - eval; + eval $testcase; diag $@ if $@; } }