X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F63-uplevel-ctl.t;h=6b1ec188480053cb683018af750a0a076dcffd0a;hb=2236279ceecd37fc3e752bdf1142808a0f671d6e;hp=645d6f89439b2ccf4f943ab28d93675f6d581243;hpb=1da764455f3f82a24aad0881beb01f5e4d3cf858;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/63-uplevel-ctl.t b/t/63-uplevel-ctl.t index 645d6f8..6b1ec18 100644 --- a/t/63-uplevel-ctl.t +++ b/t/63-uplevel-ctl.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 3 + (3 + 4 + 4) + (3 + 4 + 4) + 5 + 3*3 + (4 + 7); +use Test::More tests => 3 + (3 + 4 + 4) + (3 + 4 + 4) + 5 + 3*3 + (4 + 7) + 1; use Scope::Upper qw; @@ -151,7 +151,7 @@ our $hurp; SKIP: { skip "Causes failures during global destruction on perl 5.8.[0126]" => 5 - if ("$]" >= 5.008 and "$]" <= 5.008002) or "$]" == 5.008006; + if ("$]" >= 5.008 and "$]" <= 5.008_002) or "$]" == 5.008_006; my $desc = 'exception with an eval and a local $@ in between'; local $hurp = 'durp'; local $@; @@ -223,7 +223,7 @@ SKIP: { like $@, qr/^tomato at \Q$0\E line $line/, "$desc (third): correct exception"; } -my $has_B = do { local $@; eval 'require B; 1' }; +my $has_B = do { local $@; eval { require B; 1 } }; sub check_depth { my ($code, $expected, $desc) = @_; @@ -307,3 +307,19 @@ sub clash { is $@, '', "$desc: no exception outside"; check_depth \&clash, 0, "$desc: depth at the beginning"; } + +# XS + +{ + my $desc = 'exception thrown from XS'; + local $@; + eval { + sub { + &uplevel(\&uplevel => \1, HERE); + }->(); + }; + my $line = __LINE__-2; # The error happens at the target frame. + like $@, + qr/^First argument to uplevel must be a code reference at \Q$0\E line $line/, + "$desc: correct error"; +}