X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F60-uplevel-target.t;h=246af7b351913f70ac67a1fb4a74cdc1e5b1ca1f;hb=c85df5478ff2d9380ee42b0e5a70461d063745d6;hp=6b3a444742fe6a057e2930389e9a3790cc5d26e9;hpb=361c0283804eb19b323c57003e40ff18ac84c089;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/60-uplevel-target.t b/t/60-uplevel-target.t index 6b3a444..246af7b 100644 --- a/t/60-uplevel-target.t +++ b/t/60-uplevel-target.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => (1 * 3 + 2 * 4 + 3 * 5) * 2 + 7 + 5 + 6 + 5; +use Test::More tests => (1 * 3 + 2 * 4 + 3 * 5) * 2 + 7 + 5 + 6 + 5 + 6; use Scope::Upper qw; @@ -225,4 +225,32 @@ sub four { is $destroyed, 1, "$desc: target is detroyed"; } + + { + local $@; + local $destroyed = 0; + my $desc = 'code destruction'; + + { + my $lexical; + my $code = sub { + ++$lexical; + is $destroyed, 0, "$desc: not yet 1"; + }; + + eval { + sub { + sub { + &uplevel($code, UP); + is $destroyed, 0, "$desc: not yet 2"; + }->(); + is $destroyed, 0, "$desc: not yet 2"; + }->(); + }; + is $@, '', "$desc: no error"; + is $destroyed, 0, "$desc: not yet 3"; + }; + + is $destroyed, 0, "$desc: code is destroyed"; + } }