summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-11-30 02:12:25 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-12-03 18:37:15 +0000
commit304ee84bde82d4eee33b0d0ff03080b360eae72b (patch)
tree2af3868cdb7699241cbafb8e821b8d576e09a381 /t
parentbc463c31e3b3b9255e7de0313166381f35400520 (diff)
downloadperl-304ee84bde82d4eee33b0d0ff03080b360eae72b.tar.gz
Re: [perl #41010] (?(COND)) in pattern matching not working properly
Message-ID: <9b18b3110611291612i137803f4lab2739e3d9af40f7@mail.gmail.com> p4raw-id: //depot/perl@29441
Diffstat (limited to 't')
-rwxr-xr-xt/op/pat.t35
1 files changed, 34 insertions, 1 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 2bc5da6837..245f1b50c8 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -4121,6 +4121,39 @@ for my $c ("z", "\0", "!", chr(254), chr(256)) {
ok("foobarbarxyz" =~ qr/(foo${qr_barR1})xyz/);
ok("foobarbarxyz" =~ qr/(foo(bar)\R1)xyz/);
}
+{
+ local $Message = "RT#41010";
+ my @tails=('','(?(1))','(|)','()?');
+ my @quants=('*','+');
+ my $doit=sub {
+ my $pats= shift;
+ for (@_) {
+ for my $pat (@$pats) {
+ for my $quant (@quants) {
+ for my $tail (@tails) {
+ my $re = "($pat$quant\$)$tail";
+ ok(/$re/ && $1 eq $_,"'$_'=~/$re/");
+ ok(/$re/m && $1 eq $_,"'$_'=~/$re/m");
+ }
+ }
+ }
+ }
+ };
+
+ my @dpats=(
+ '\d',
+ '[1234567890]',
+ '(1|[23]|4|[56]|[78]|[90])',
+ '(?:1|[23]|4|[56]|[78]|[90])',
+ '(1|2|3|4|5|6|7|8|9|0)',
+ '(?:1|2|3|4|5|6|7|8|9|0)',
+ );
+ my @spats=('[ ]',' ','( |\t)','(?: |\t)','[ \t]','\s');
+ my @sstrs=(' ');
+ my @dstrs=('12345');
+ $doit->(\@spats,@sstrs);
+ $doit->(\@dpats,@dstrs);
+}
# Test counter is at bottom of file. Put new tests above here.
#-------------------------------------------------------------------
@@ -4168,7 +4201,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 = 1375;
+ $::TestCount = 1567;
print "1..$::TestCount\n";
}