summaryrefslogtreecommitdiff
path: root/t/bigmem
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-25 00:41:07 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-25 12:23:59 -0700
commit99a90e5967b33d68a38c309edf24275f1c8a979f (patch)
treecfc8416c25f4661ec9901d4103e77a5f636a2d90 /t/bigmem
parent389ecb564541f5a336b531db204970925ed27790 (diff)
downloadperl-99a90e5967b33d68a38c309edf24275f1c8a979f.tar.gz
[perl #116907] Allow //g matching past 2**31 threshold
Change the internal fields for storing positions so that //g in scalar context can move past the 2**31 character threshold. Before this com- mit, the numbers would wrap, resulting in assertion failures. The changes in this commit are only enough to get the added test pass- ing. Stay tuned for more.
Diffstat (limited to 't/bigmem')
-rw-r--r--t/bigmem/regexp.t12
1 files changed, 10 insertions, 2 deletions
diff --git a/t/bigmem/regexp.t b/t/bigmem/regexp.t
index ef029fbd9b..ef74e59ab7 100644
--- a/t/bigmem/regexp.t
+++ b/t/bigmem/regexp.t
@@ -12,11 +12,19 @@ $ENV{PERL_TEST_MEMORY} >= 2
$Config{ptrsize} >= 8
or skip_all("Need 64-bit pointers for this test");
-plan(2);
+plan(3);
# [perl #116907]
# ${\2} to defeat constant folding, which in this case actually slows
# things down
-my $x=" "x(${\2}**31);
+my $x=" "x(${\2}**31) . "abcdefg";
ok $x =~ /./, 'match against long string succeeded';
is "$-[0]-$+[0]", '0-1', '@-/@+ after match against long string';
+
+pos $x = 2**31-1;
+my $result;
+for(1..5) {
+ $x =~ /./g;
+ $result .= "$&-";
+}
+is $result," -a-b-c-d-", 'scalar //g hopping past the 2**31 threshold';