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<uplevel HERE SUB CALLER>;
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 $@;
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";
+}