X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F31-localize_elem-level.t;h=cd700c7a4cb8a74c5b671a3ef2458944d315eddb;hb=e7846e7f6fded4c4a3139054c5206c1480711867;hp=b95acd694e9256cad9794f68acc819082ef53698;hpb=4106be64bc49ed8698c505798cc260bb8ae242a5;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/31-localize_elem-level.t b/t/31-localize_elem-level.t index b95acd6..cd700c7 100644 --- a/t/31-localize_elem-level.t +++ b/t/31-localize_elem-level.t @@ -3,17 +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/; +use Scope::Upper qw; -use lib 't/lib'; use Scope::Upper::TestGenerator; our ($x, $testcase); local $Scope::Upper::TestGenerator::call = sub { my ($height, $level, $i) = @_; + $level = $level ? 'UP ' x $level : 'HERE'; return [ "localize_elem '\@main::a', 1 => 3 => $level;\n" ]; }; @@ -28,11 +29,10 @@ our @a; for my $level (0 .. 2) { for my $height ($level + 1 .. $level + 2) { my $tests = Scope::Upper::TestGenerator::gen($height, $level); - for (@$tests) { - $testcase = $_; + for $testcase (@$tests) { $x = undef; @a = (1, 2); - eval; + eval $testcase; diag $@ if $@; } } @@ -40,8 +40,9 @@ for my $level (0 .. 2) { local $Scope::Upper::TestGenerator::call = sub { my ($height, $level, $i) = @_; + $level = $level ? 'UP ' x $level : 'HERE'; return [ "localize_elem '%main::h', 'a' => 1 => $level;\n" ]; -}; +}; local $Scope::Upper::TestGenerator::test = sub { my ($height, $level, $i) = @_; @@ -54,11 +55,10 @@ our %h; for my $level (0 .. 2) { for my $height ($level + 1 .. $level + 2) { my $tests = Scope::Upper::TestGenerator::gen($height, $level); - for (@$tests) { - $testcase = $_; + for $testcase (@$tests) { $x = undef; %h = (); - eval; + eval $testcase; diag $@ if $@; } }