X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F60-uplevel-target.t;h=1dcf3251b71591ec061af186942079d9f5dd6436;hb=0c640ded3d3d3939e6fb99c3a94c6bf6e54a360a;hp=246af7b351913f70ac67a1fb4a74cdc1e5b1ca1f;hpb=0f722a753fb30ba5c163c5efccce6b3865a58d07;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/60-uplevel-target.t b/t/60-uplevel-target.t index 246af7b..1dcf325 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 + 6; +use Test::More tests => (1 * 3 + 2 * 4 + 3 * 5) * 2 + 7 + 5 + 6 + 5 + 6 + 5; use Scope::Upper qw; @@ -253,4 +253,32 @@ sub four { is $destroyed, 0, "$desc: code is destroyed"; } + + SKIP: { + skip 'This fails even with a plain subroutine call on 5.8.x' => 5 + if "$]" < 5.009; + local $@; + local $destroyed = 0; + my $desc = 'code destruction and goto'; + + { + my $lexical = 0; + my $cb = sub { + ++$lexical; + is $destroyed, 0, "$desc: not yet 1"; + }; + $cb = bless $cb, 'Scope::Upper::TestCodeDestruction'; + + eval { + sub { + &uplevel(sub { goto $cb } => HERE); + is $destroyed, 0, "$desc: not yet 2"; + }->(); + }; + is $@, '', "$desc: no error"; + is $destroyed, 0, "$desc: not yet 3"; + } + + is $destroyed, 1, "$desc: code is destroyed"; + } }