From b7a3506667c18cfc70741a0ddfa0a7815e72775a Mon Sep 17 00:00:00 2001 From: Ilya Zakharevich Date: Mon, 18 Jan 1999 15:57:02 -0500 Subject: Fixing \G bug by Francois Desarmenien To: Mailing list Perl5 Message-ID: <19990118205702.A18379@monk.mps.ohio-state.edu> p4raw-id: //depot/cfgperl@2644 --- t/op/pat.t | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 't/op/pat.t') 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"; -- cgit v1.2.1