diff options
author | Yves Orton <demerphq@gmail.com> | 2006-12-03 17:55:55 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-12-04 09:21:16 +0000 |
commit | 2bf803e2214c46ec8286bc855080cf05bb5cf7a4 (patch) | |
tree | 57aa52d4a7a7705e96d7190e3abc96beb0b4c066 /t | |
parent | ba760cefee81a5e9f04523b6940e0759647cb917 (diff) | |
download | perl-2bf803e2214c46ec8286bc855080cf05bb5cf7a4.tar.gz |
\R is supposed to mean something else so switch to \g and make it more useful in the process
Message-ID: <9b18b3110612030755o241e6372o9870ecce9c42e3d5@mail.gmail.com>
p4raw-id: //depot/perl@29445
Diffstat (limited to 't')
-rwxr-xr-x | t/op/pat.t | 19 | ||||
-rw-r--r-- | t/op/re_tests | 8 |
2 files changed, 19 insertions, 8 deletions
diff --git a/t/op/pat.t b/t/op/pat.t index 245f1b50c8..31922e9e36 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -4113,13 +4113,13 @@ for my $c ("z", "\0", "!", chr(254), chr(256)) { } { local $Message = "http://nntp.perl.org/group/perl.perl5.porters/118663"; - my $qr_barR1 = qr/(bar)\R1/; + my $qr_barR1 = qr/(bar)\g-1/; ok("foobarbarxyz" =~ $qr_barR1); ok("foobarbarxyz" =~ qr/foo${qr_barR1}xyz/); ok("foobarbarxyz" =~ qr/(foo)${qr_barR1}xyz/); - ok("foobarbarxyz" =~ qr/(foo)(bar)\R1xyz/); + ok("foobarbarxyz" =~ qr/(foo)(bar)\g{-1}xyz/); ok("foobarbarxyz" =~ qr/(foo${qr_barR1})xyz/); - ok("foobarbarxyz" =~ qr/(foo(bar)\R1)xyz/); + ok("foobarbarxyz" =~ qr/(foo(bar)\g{-1})xyz/); } { local $Message = "RT#41010"; @@ -4154,7 +4154,16 @@ for my $c ("z", "\0", "!", chr(254), chr(256)) { $doit->(\@spats,@sstrs); $doit->(\@dpats,@dstrs); } - +{ + local $Message = "\$REGMARK"; + our @r=(); + ok('foofoo' =~ /foo (*MARK:foo) (?{push @r,$REGMARK}) /x); + iseq("@r","foo"); + iseq($REGMARK,"foo"); + ok('foofoo' !~ /foo (*MARK:foo) (*FAIL) /x); + ok(!$REGMARK); + iseq($REGERROR,'foo'); +} # Test counter is at bottom of file. Put new tests above here. #------------------------------------------------------------------- # Keep the following tests last -- they may crash perl @@ -4201,7 +4210,7 @@ ok((q(a)x 100) =~ /^(??{'(.)'x 100})/, iseq(0+$::test,$::TestCount,"Got the right number of tests!"); # Don't forget to update this! BEGIN { - $::TestCount = 1567; + $::TestCount = 1573; print "1..$::TestCount\n"; } diff --git a/t/op/re_tests b/t/op/re_tests index 925bb36cb4..d0f6ae3b13 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -1190,9 +1190,11 @@ a*(*F) aaaab n - - (a)(?:(?-1)|(?+1))(b) abb y $1-$2 a-b (a)(?:(?-1)|(?+1))(b) acb n - - -(foo)(\R2) foofoo y $1-$2 foo-foo -(foo)(\R2)(foo)(\R2) foofoofoofoo y $1-$2-$3-$4 foo-foo-foo-foo -(([abc]+) \R1)(([abc]+) \R1) abc abccba cba y $2-$4 abc-cba +(foo)(\g-2) foofoo y $1-$2 foo-foo +(foo)(\g-2)(foo)(\g-2) foofoofoofoo y $1-$2-$3-$4 foo-foo-foo-foo +(([abc]+) \g-1)(([abc]+) \g{-1}) abc abccba cba y $2-$4 abc-cba +(a)(b)(c)\g1\g2\g3 abcabc y $1$2$3 abc + /(?'n'foo) \k<n>/ ..foo foo.. y $1 foo /(?'n'foo) \k<n>/ ..foo foo.. y $+{n} foo |