X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F32-localize_elem-block.t;h=82cabc7ce515fd2419c031a5c7484b7d30a8e0e0;hb=e7846e7f6fded4c4a3139054c5206c1480711867;hp=ec9fb9f137aed34b59f0e1918ed53135b4b79daa;hpb=2c38cd5c99372e9ab0a91cbaedebf68bec6ed2c7;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/32-localize_elem-block.t b/t/32-localize_elem-block.t index ec9fb9f..82cabc7 100644 --- a/t/32-localize_elem-block.t +++ b/t/32-localize_elem-block.t @@ -6,15 +6,15 @@ use warnings; use lib 't/lib'; use Test::Leaner 'no_plan'; -use Scope::Upper qw/localize_elem UP HERE/; +use Scope::Upper qw; 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 $@; } }