X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F67-uplevel-scope.t;h=b564a547003b6ef624953a8ca6a20b1b8a2817d5;hb=76f7748a793b1d04798c743cc70b46a1bf657300;hp=92105fcfec759dbeba8a612d9ec5c1547e82c5ed;hpb=c85df5478ff2d9380ee42b0e5a70461d063745d6;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/67-uplevel-scope.t b/t/67-uplevel-scope.t index 92105fc..b564a54 100644 --- a/t/67-uplevel-scope.t +++ b/t/67-uplevel-scope.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4 + 3 * 2; +use Test::More tests => 2 + 2 * 6 + 3 * 2; use Scope::Upper qw; @@ -30,19 +30,35 @@ use Scope::Upper qw; } sub { - "abc" =~ /(.)/; + 'abc' =~ /(.)/; + is $1, 'a', 'match variables scoping 1: before 1'; sub { - "xyz" =~ /(.)/; - uplevel { is $1, 'x', 'match variables scoping 1' } HERE; + 'uvw' =~ /(.)/; + is $1, 'u', 'match variables scoping 1: before 2'; + uplevel { + is $1, 'u', 'match variables scoping 1: before 3'; + 'xyz' =~ /(.)/; + is $1, 'x', 'match variables scoping 1: after 1'; + } HERE; + is $1, 'u', 'match variables scoping 1: after 2'; }->(); + is $1, 'a', 'match variables scoping 1: after 3'; }->(); sub { - "abc" =~ /(.)/; + 'abc' =~ /(.)/; + is $1, 'a', 'match variables scoping 2: before 1'; sub { - "xyz" =~ /(.)/; - uplevel { is $1, 'x', 'match variables scoping 2' } UP; + 'uvw' =~ /(.)/; + is $1, 'u', 'match variables scoping 2: before 2'; + uplevel { + is $1, 'u', 'match variables scoping 2: before 3'; + 'xyz' =~ /(.)/; + is $1, 'x', 'match variables scoping 2: after 1'; + } UP; + is $1, 'u', 'match variables scoping 2: after 2'; }->(); + is $1, 'a', 'match variables scoping 2: after 3'; }->(); SKIP: {