fix unicode split /\s+/
[p5sagit/p5-mst-13.2.git] / t / op / regexp.t
index 6a469b7..a7cd5fc 100755 (executable)
@@ -28,6 +28,9 @@
 #
 # \n in the tests are interpolated, as are variables of the form ${\w+}.
 #
+# Blanks lines are treated as PASSING tests to keep the line numbers
+# linked to the test number.
+#
 # If you want to add a regular expression test that can't be expressed
 # in this format, don't add it here: put it in op/pat.t instead.
 #
@@ -58,6 +61,11 @@ $| = 1;
 print "1..$numtests\n# $iters iterations\n";
 TEST:
 while (<TESTS>) {
+    if (!/\S/ || /^\s*#/) {
+        print "ok $. # (Blank line or comment)\n";
+        if (/\S/) { print $_ };
+        next;
+    }
     chomp;
     s/\\n/\n/g;
     ($pat, $subject, $result, $repl, $expect, $reason) = split(/\t/,$_,6);
@@ -117,7 +125,15 @@ EOFCODE
        }
        else {
            if (!$match || $got ne $expect) {
-               print "not ok $. ($study) $input => `$got', match=$match\n$code\n";
+               eval { require Data::Dumper };
+               if ($@) {
+                   print "not ok $. ($study) $input => `$got', match=$match\n$code\n";
+               }
+               else { # better diagnostics
+                   my $s = Data::Dumper->new([$subject],['subject'])->Useqq(1)->Dump;
+                   my $g = Data::Dumper->new([$got],['got'])->Useqq(1)->Dump;
+                   print "not ok $. ($study) $input => `$got', match=$match\n$s\n$g\n$code\n";
+               }
                next TEST;
            }
        }