X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/4b7c0884db5c600085cea2e6463d72ec6e4357f9..1f039d60d3646db9ab9065236e00c45cbf099138:/t/op/loopctl.t?ds=sidebyside diff --git a/t/op/loopctl.t b/t/op/loopctl.t index d28c191..fcb1237 100644 --- a/t/op/loopctl.t +++ b/t/op/loopctl.t @@ -36,7 +36,7 @@ BEGIN { } require "test.pl"; -plan( tests => 61 ); +plan( tests => 64 ); my $ok; @@ -1067,3 +1067,40 @@ cmp_ok($ok,'==',1,'dynamically scoped'); "constant optimization doesn't change return value"); } } + +# [perl #113684] +last_113684: +{ + label1: + { + my $label = "label1"; + eval { last $label }; + fail("last with non-constant label"); + last last_113684; + } + pass("last with non-constant label"); +} +next_113684: +{ + label2: + { + my $label = "label2"; + eval { next $label }; + fail("next with non-constant label"); + next next_113684; + } + pass("next with non-constant label"); +} +redo_113684: +{ + my $count; + label3: + { + if ($count++) { + pass("redo with non-constant label"); last redo_113684 + } + my $label = "label3"; + eval { redo $label }; + fail("redo with non-constant label"); + } +}