X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F25-localize-multi.t;h=e696b547c518da132345159a28ca09fd98d7a34e;hb=0a6221d3f467b5f819e3c119b4cda0218399cb51;hp=f205e75c9902e5258459d00611384b22be18f237;hpb=e4bb8d889bcaaf2a3c9f1f9cd2a8185115db5db0;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/25-localize-multi.t b/t/25-localize-multi.t index f205e75..e696b54 100644 --- a/t/25-localize-multi.t +++ b/t/25-localize-multi.t @@ -5,11 +5,11 @@ use warnings; use Test::More tests => 10 + 5 + 6; -use Scope::Upper qw/localize/; +use Scope::Upper qw/localize UP HERE/; our $x; -sub loc { local $x; my $y = $_[1]; localize '$x', $y, $_[0] + 1 } +sub loc { local $x; my $y = $_[0]; localize '$x', $y => $_[1] } $x = 0; { @@ -17,7 +17,7 @@ $x = 0; local $x = 7; { local $x = 8; - loc(1, 1); + loc 1 => UP; is($x, 8, 'not localized'); local $x = 9; is($x, 9, 'not localized'); @@ -43,10 +43,10 @@ $x = 0; { { local $x = 8; - loc(2, 1); + loc 1 => UP UP; is($x, 8, 'not localized'); } - loc(0, 2); + loc 2 => HERE; is($x, 2, 'localized to 2'); } is($x, 1, 'localized to 1'); @@ -59,10 +59,10 @@ $x = 0; local $x; { { - loc(2, 1); + loc 1 => UP UP; is($x, undef, 'not localized'); local $x; - loc(1, 2); + loc 2 => UP; is($x, undef, 'not localized'); } is($x, 2, 'localized to 2');