From: Vincent Pit Date: Wed, 18 Jul 2012 20:59:16 +0000 (+0200) Subject: Test uplevel's behaviour regarding to match variables more thoroughly X-Git-Tag: v0.19~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=d5523f091e49e6c770977c9070d40b795be91bf4;p=perl%2Fmodules%2FScope-Upper.git Test uplevel's behaviour regarding to match variables more thoroughly --- 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: {