Skip to content

Commit e940a13

Browse files
committed
Add tests for exceptions to now-fatalized uses of goto LABEL
1 parent f31afb2 commit e940a13

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

t/op/goto.t

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ BEGIN {
1212
use warnings;
1313
use strict;
1414
use Config;
15-
plan tests => 52;
15+
plan tests => 53;
1616

1717
our $TODO;
1818

@@ -556,3 +556,20 @@ pass("bug 132799");
556556
"goto LABEL can't be used to go into a construct that is optimized away");
557557
}
558558

559+
note("Tests of functionality fatalized in Perl 5.44");
560+
my $msg = q|Use of "goto" to jump into a construct is no longer permitted|;
561+
562+
{
563+
564+
my $false = 0;
565+
my $thisok = 0;
566+
567+
local $@;
568+
eval {
569+
for (my $p=1; $p && goto A; $p=0) {
570+
A: $thisok = 1;
571+
}
572+
};
573+
like($@, qr/$msg/,
574+
"Got expected exception; formerly: following goto and for(;;) loop");
575+
}

0 commit comments

Comments
 (0)