summaryrefslogtreecommitdiff
path: root/t/op/pat.t
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-01-18 15:57:02 -0500
committerJarkko Hietaniemi <jhi@iki.fi>1999-01-19 08:42:25 +0000
commitb7a3506667c18cfc70741a0ddfa0a7815e72775a (patch)
tree881567dde0612c914355746b01fa9eadef97d74a /t/op/pat.t
parent8544a51455f28abb200ac3df7527c5a0589bfda5 (diff)
downloadperl-b7a3506667c18cfc70741a0ddfa0a7815e72775a.tar.gz
Fixing \G bug by Francois Desarmenien
To: Mailing list Perl5 <perl5-porters@perl.org> Message-ID: <19990118205702.A18379@monk.mps.ohio-state.edu> p4raw-id: //depot/cfgperl@2644
Diffstat (limited to 't/op/pat.t')
-rwxr-xr-xt/op/pat.t42
1 files changed, 41 insertions, 1 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index abb10fd841..63219a39f8 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -4,7 +4,7 @@
# the format supported by op/regexp.t. If you want to add a test
# that does fit that format, add it to op/re_tests, not here.
-print "1..178\n";
+print "1..184\n";
BEGIN {
chdir 't' if -d 't';
@@ -803,6 +803,46 @@ print "#'@res' '$_'\nnot "
print "ok $test\n";
$test++;
+#Some more \G anchor checks
+$foo='aabbccddeeffgg';
+
+pos($foo)=1;
+
+$foo=~/.\G(..)/g;
+print "not " unless($1 eq 'ab');
+print "ok $test\n";
+$test++;
+
+pos($foo) += 1;
+$foo=~/.\G(..)/g;
+print "not " unless($1 eq 'cc');
+print "ok $test\n";
+$test++;
+
+pos($foo) += 1;
+$foo=~/.\G(..)/g;
+print "not " unless($1 eq 'de');
+print "ok $test\n";
+$test++;
+
+undef pos $foo;
+
+$foo=~/\G(..)/g;
+print "not " unless($1 eq 'aa');
+print "ok $test\n";
+$test++;
+
+$foo=~/\G(..)/g;
+print "not " unless($1 eq 'bb');
+print "ok $test\n";
+$test++;
+
+pos($foo)=5;
+$foo=~/\G(..)/g;
+print "not " unless($1 eq 'cd');
+print "ok $test\n";
+$test++;
+
# see if matching against temporaries (created via pp_helem()) is safe
{ foo => "ok $test\n".$^X }->{foo} =~ /^(.*)\n/g;
print "$1\n";