YA sync with mainline
[p5sagit/p5-mst-13.2.git] / t / op / pat.t
index 9dc3ac7..142b82e 100755 (executable)
@@ -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..207\n";
+print "1..210\n";
 
 BEGIN {
     chdir 't' if -d 't';
@@ -906,50 +906,88 @@ print "ok $test\n";
 $test++;
 
 @a = map chr,0..255;
-print "not " if grep(/\S/,@a) != grep(/[^\s]/,@a);
+
+@b = grep(/\S/,@a);
+@c = grep(/[^\s]/,@a);
+print "not " if "@b" ne "@c";
+print "ok $test\n";
+$test++;
+
+@b = grep(/\S/,@a);
+@c = grep(/[\S]/,@a);
+print "not " if "@b" ne "@c";
+print "ok $test\n";
+$test++;
+
+@b = grep(/\s/,@a);
+@c = grep(/[^\S]/,@a);
+print "not " if "@b" ne "@c";
+print "ok $test\n";
+$test++;
+
+@b = grep(/\s/,@a);
+@c = grep(/[\s]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\S/,@a) != grep(/[\S]/,@a);
+@b = grep(/\D/,@a);
+@c = grep(/[^\d]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\s/,@a) != grep(/[^\S]/,@a);
+@b = grep(/\D/,@a);
+@c = grep(/[\D]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\s/,@a) != grep(/[\s]/,@a);
+@b = grep(/\d/,@a);
+@c = grep(/[^\D]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\D/,@a) != grep(/[^\d]/,@a);
+@b = grep(/\d/,@a);
+@c = grep(/[\d]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\D/,@a) != grep(/[\D]/,@a);
+@b = grep(/\W/,@a);
+@c = grep(/[^\w]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\d/,@a) != grep(/[^\D]/,@a);
+@b = grep(/\W/,@a);
+@c = grep(/[\W]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\d/,@a) != grep(/[\d]/,@a);
+@b = grep(/\w/,@a);
+@c = grep(/[^\W]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\W/,@a) != grep(/[^\w]/,@a);
+@b = grep(/\w/,@a);
+@c = grep(/[\w]/,@a);
+print "not " if "@b" ne "@c";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\W/,@a) != grep(/[\W]/,@a);
+# see if backtracking optimization works correctly
+"\n\n" =~ /\n  $ \n/x or print "not ";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\w/,@a) != grep(/[^\W]/,@a);
+"\n\n" =~ /\n* $ \n/x or print "not ";
 print "ok $test\n";
 $test++;
 
-print "not " if grep(/\w/,@a) != grep(/[\w]/,@a);
+"\n\n" =~ /\n+ $ \n/x or print "not ";
 print "ok $test\n";
 $test++;