Lots of consting
[p5sagit/p5-mst-13.2.git] / t / op / regmesg.t
index 24f6f31..1b613ed 100644 (file)
@@ -61,7 +61,7 @@ my @death =
 
  '/\p{x/' => 'Missing right brace on \p{} in regex; marked by {#} in m/\p{{#}x/',
 
- 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/',
+ '/[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/',
 
  '/(x)\2/' => 'Reference to nonexistent group in regex; marked by {#} in m/(x)\2{#}/',
 
@@ -69,7 +69,7 @@ my @death =
 
  '/\x{1/' => 'Missing right brace on \x{} in regex; marked by {#} in m/\x{{#}1/',
 
- 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/',
+ '/[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/',
 
  '/[[:barf:]]/' => 'POSIX class [:barf:] unknown in regex; marked by {#} in m/[[:barf:]{#}]/',
 
@@ -78,6 +78,10 @@ my @death =
  '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions in regex; marked by {#} in m/[[.barf.]{#}]/',
   
  '/[z-a]/' => 'Invalid [] range "z-a" in regex; marked by {#} in m/[z-a{#}]/',
+
+ '/\p/' => 'Empty \p{} in regex; marked by {#} in m/\p{#}/',
+
+ '/\P{}/' => 'Empty \P{} in regex; marked by {#} in m/\P{{#}}/',
 );
 
 ##
@@ -94,6 +98,8 @@ my @death =
 
     'm/[a-\d]/' => 'False [] range "a-\d" in regex; marked by {#} in m/[a-\d{#}]/',
     'm/[\w-x]/' => 'False [] range "\w-" in regex; marked by {#} in m/[\w-{#}x]/',
+    'm/[a-\pM]/' => 'False [] range "a-\pM" in regex; marked by {#} in m/[a-\pM{#}]/',
+    'm/[\pM-x]/' => 'False [] range "\pM-" in regex; marked by {#} in m/[\pM-{#}x]/',
     "m'\\y'"     => 'Unrecognized escape \y passed through in regex; marked by {#} in m/\y{#}/',
 );
 
@@ -127,10 +133,11 @@ while (@death)
     chomp $@;
     $result =~ s/{\#}/$marker1/;
     $result =~ s/{\#}/$marker2/;
+    $result .= " at ";
     if ($@ !~ /^\Q$result/) {
        print "# For $regex, expected:\n#  $result\n# Got:\n#  $@\n#\nnot ";
     }
-    print "ok $count\n";
+    print "ok $count - $regex\n";
 }
 
 
@@ -160,6 +167,7 @@ while (@warning)
     }
     $result =~ s/{\#}/$marker1/;
     $result =~ s/{\#}/$marker2/;
+    $result .= " at ";
     if ($warning !~ /^\Q$result/)
     {
        print <<"EOM";
@@ -172,7 +180,7 @@ not ok $count
 EOM
        next;
     }
-    print "ok $count\n";
+    print "ok $count - $regex\n";
 }