summaryrefslogtreecommitdiff
path: root/t/op/pat.t
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2007-04-01 00:27:02 +0000
committerDave Mitchell <davem@fdisolutions.com>2007-04-01 00:27:02 +0000
commit19b95bf092bc6fdb9455fe107fc46111b0a1ec31 (patch)
treec0a2f69a85c98404ef64097caac0800dfe686308 /t/op/pat.t
parent9bd878171021311bd025e403714388c68ff5d9e2 (diff)
downloadperl-19b95bf092bc6fdb9455fe107fc46111b0a1ec31.tar.gz
fix $^R scoping bug.
By setting the outer saved $^R to the current $^R just at the end of a successful match, and ensuring that that the savestack doesn't get popped beforehand, the code is simplified and fixes a bug. p4raw-id: //depot/perl@30818
Diffstat (limited to 't/op/pat.t')
-rwxr-xr-xt/op/pat.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 71ddbe9e8f..6d3cafd62d 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -4127,6 +4127,16 @@ for my $c ("z", "\0", "!", chr(254), chr(256)) {
iseq($^R,'last regexp code result');
}
iseq($^R,'Nothing');
+
+ {
+ local $^R = "Bad";
+ ok('x foofoo y' =~ m{
+ (foo|bar)\1 # this time without the +
+ (?{"last regexp code result"})
+ }x);
+ iseq($^R,'last regexp code result');
+ }
+ iseq($^R,'Nothing');
}
{
local $Message="RT#22395";
@@ -4405,7 +4415,7 @@ ok($@=~/\QSequence \k... not terminated in regex;\E/);
iseq(0+$::test,$::TestCount,"Got the right number of tests!");
# Don't forget to update this!
BEGIN {
- $::TestCount = 1655;
+ $::TestCount = 1658;
print "1..$::TestCount\n";
}