X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F63-uplevel-ctl.t;h=4f031bce414ef403fa3127dab8280810fc4129a5;hb=44b173f9220cfdd1afd01ae4baf414f885d2f0b2;hp=645d6f89439b2ccf4f943ab28d93675f6d581243;hpb=8afcc751a1eb6d635f6a1a015711ecc674072a38;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/63-uplevel-ctl.t b/t/63-uplevel-ctl.t index 645d6f8..4f031bc 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; @@ -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"; +}