diff options
Diffstat (limited to 't/op/caller.t')
-rw-r--r-- | t/op/caller.t | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/t/op/caller.t b/t/op/caller.t index 9fc9a1ce39..865b005bf5 100644 --- a/t/op/caller.t +++ b/t/op/caller.t @@ -5,7 +5,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; set_up_inc('../lib'); - plan( tests => 109 ); # some tests are run in a BEGIN block + plan( tests => 111 ); # some tests are run in a BEGIN block } my @c; @@ -349,6 +349,20 @@ do './op/caller.pl' or die $@; like($Cpack::callers[$_], qr{GH_15109/Apack.pm:3}, "GH #15109 level $_") for 3..5; like($Cpack::callers[$_], qr{\(eval \d+\):1}, "GH #15109 level $_") for 6..8; like($Cpack::callers[$_], qr{caller\.t}, "GH #15109 level $_") for 9; + + # GH #15109 followup - the original fix wasn't saving cop_warnings + # correctly and this code used to crash or fail valgrind + + my $w = 0; + local $SIG{__WARN__} = sub { $w++ }; + eval q{ + use warnings; + no warnings 'numeric'; # ensure custom cop_warnings + use Foo; # this used to mess up warnings flags + BEGIN { my $x = "foo" + 1; } # potential "numeric" warning + }; + is ($@, "", "GH #15109 - eval okay"); + is ($w, 0, "GH #15109 - warnings restored"); } { @@ -357,11 +371,9 @@ do './op/caller.pl' or die $@; my ($pkg, $file, $line) = caller; ::is $file, 'virtually/op/caller.t', "BEGIN block sees correct caller filename"; ::is $line, 12345, "BEGIN block sees correct caller line"; - TODO: { - local $::TODO = "BEGIN blocks have wrong caller package [perl #129239]"; - ::is $pkg, 'RT129239', "BEGIN block sees correct caller package"; - } + ::is $pkg, 'RT129239', "BEGIN block sees correct caller package"; #line 12345 "virtually/op/caller.t" } + } |