X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/aaee23ae9c2dfc4e671dcc6a11a59f9baf00f533..00f6437b30bbbd24904cbecfa1c00ab91f7315e5:/t/re/pat_rt_report.t diff --git a/t/re/pat_rt_report.t b/t/re/pat_rt_report.t index 262e8d3..d19d1df 100644 --- a/t/re/pat_rt_report.t +++ b/t/re/pat_rt_report.t @@ -22,7 +22,7 @@ BEGIN { } -plan tests => 2527; # Update this when adding/deleting tests. +plan tests => 2530; # Update this when adding/deleting tests. run_tests() unless caller; @@ -1143,6 +1143,19 @@ EOP ok("blah blah" =~ /$pattern/, $message); ok("blah blah" =~ /(?:$pattern)h/, $message); } + + { + # [perl #4289] First mention $& after a match + fresh_perl_is( + '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$&|, "\n"', + "b\n", {}, '$& first mentioned after match'); + fresh_perl_is( + '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$`|, "\n"', + "a\n", {}, '$` first mentioned after match'); + fresh_perl_is( + '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$\'|,"\n"', + "c\n", {}, '$\' first mentioned after match'); + } } # End of sub run_tests 1;