X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F62-uplevel-return.t;h=1271de334e85c5bd922f2db8cb6a6152b9b57403;hb=f096bbc131e6ca04b079a22f2e48efff1a6c3ddb;hp=ccf763bd1528a47ccd3e8ed6a90c0b6ffd15c025;hpb=c85df5478ff2d9380ee42b0e5a70461d063745d6;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/62-uplevel-return.t b/t/62-uplevel-return.t index ccf763b..1271de3 100644 --- a/t/62-uplevel-return.t +++ b/t/62-uplevel-return.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => (13 + 5 + 4) * 2 + 1 + 3 + 11; +use Test::More tests => (13 + 5 + 4) * 2 + 1 + (3 + 3 + 1) + 11; use Scope::Upper qw; @@ -78,6 +78,20 @@ for my $run (1 .. 3) { is $cb->(), 124, "near closure returned by uplevel still works"; } +{ + my $id = 456; + for my $run (1 .. 3) { + my ($cb) = sub { + uplevel { + my $step = 2; + sub { $id += $step }; + }; + }->('dummy'); + is $cb->(), 456 + 2 * $run, "far closure returned by uplevel still works"; + } + is $id, 456 + 2 * 3, 'captured lexical has the right value at the end'; +} + # Mark {