summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-04-22 12:27:36 +0100
committerDavid Mitchell <davem@iabyn.com>2015-04-22 12:27:36 +0100
commita911bb254071ab7112c309e8245494c182ad9fe2 (patch)
treea5659d37c80df992bb956f0fa382227d8c132abf /t
parent6b7f14c2bfbcbd1e8b2192eaba403eb382f2c0cf (diff)
downloadperl-a911bb254071ab7112c309e8245494c182ad9fe2.tar.gz
s/.../$_++/ge assertion failure
The code that updated pos() on a match string assumed that it was SvPOK(). Cunning code like the following converted $_ to SvIOK only: $_ = 0; s/.?/$_++/ge;
Diffstat (limited to 't')
-rw-r--r--t/re/subst.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/re/subst.t b/t/re/subst.t
index 7b9a44b991..6963c4217e 100644
--- a/t/re/subst.t
+++ b/t/re/subst.t
@@ -8,7 +8,7 @@ BEGIN {
require './charset_tools.pl';
}
-plan( tests => 260 );
+plan( tests => 261 );
$_ = 'david';
$a = s/david/rules/r;
@@ -1052,3 +1052,12 @@ SKIP: {
}
}
+
+{
+ # RT #123954 if the string getting matched against got converted during
+ # s///e so that it was no longer SvPOK, an assertion would fail when
+ # setting pos.
+ my $s1 = 0;
+ $s1 =~ s/.?/$s1++/ge;
+ is($s1, "01","RT #123954 s1");
+}