Add more known sprintf failures.
[p5sagit/p5-mst-13.2.git] / t / op / regmesg.t
index 2aaca5c..7ee1bb4 100644 (file)
@@ -2,7 +2,7 @@
 
 BEGIN {
        chdir 't' if -d 't';
-       unshift @INC, '../lib';
+       @INC = '../lib';
 }
 
 my $debug = 1;
@@ -13,8 +13,8 @@ my $debug = 1;
 ## arrays below. The {#} is a meta-marker -- it marks where the marker should
 ## go.
 
-my $marker1 = "=HERE=";
-my $marker2 = " ===HERE=== ";
+my $marker1 = "HERE";
+my $marker2 = " << HERE ";
 
 ##
 ## Key-value pairs of code/error of code that should have fatal errors.
@@ -26,90 +26,97 @@ my $inf_m1 = ($Config{reg_infty} || 32767) - 1;
 my $inf_p1 = $inf_m1 + 2;
 my @death =
 (
- '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions at {#} mark in regex m/[[=foo=]{#}]/',
+ '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=foo=]{#}]/',
 
- '/(?<= .*)/' =>  'Variable length lookbehind not implemented at {#} mark in regex m/(?<= .*){#}/',
+ '/(?<= .*)/' =>  'Variable length lookbehind not implemented before {#} mark in regex m/(?<= .*){#}/',
 
- '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented at {#} mark in regex m/(?<= x{1000}){#}/',
+ '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented before {#} mark in regex m/(?<= x{1000}){#}/',
 
- '/(?@)/' => 'Sequence (?@...) not implemented at {#} mark in regex m/(?@{#})/',
+ '/(?@)/' => 'Sequence (?@...) not implemented before {#} mark in regex m/(?@{#})/',
 
- '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced at {#} mark in regex m/(?{{#} 1/',
+ '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced before {#} mark in regex m/(?{{#} 1/',
 
- '/(?(1x))/' => 'Switch condition not recognized at {#} mark in regex m/(?(1x{#}))/',
+ '/(?(1x))/' => 'Switch condition not recognized before {#} mark in regex m/(?(1x{#}))/',
 
- '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches at {#} mark in regex m/(?(1)x|y|{#}z)/',
+ '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches before {#} mark in regex m/(?(1)x|y|{#}z)/',
 
- '/(?(x)y|x)/' => 'Unknown switch condition (?(x) at {#} mark in regex m/(?({#}x)y|x)/',
+ '/(?(x)y|x)/' => 'Unknown switch condition (?(x) before {#} mark in regex m/(?({#}x)y|x)/',
 
- '/(?/' => 'Sequence (? incomplete at {#} mark in regex m/(?{#}/',
+ '/(?/' => 'Sequence (? incomplete before {#} mark in regex m/(?{#}/',
 
- '/(?;x/' => 'Sequence (?;...) not recognized at {#} mark in regex m/(?;{#}x/',
- '/(?<;x/' => 'Sequence (?<;...) not recognized at {#} mark in regex m/(?<;{#}x/',
+ '/(?;x/' => 'Sequence (?;...) not recognized before {#} mark in regex m/(?;{#}x/',
+ '/(?<;x/' => 'Sequence (?<;...) not recognized before {#} mark in regex m/(?<;{#}x/',
 
- '/((x)/' => 'Unmatched ( at {#} mark in regex m/({#}(x)/',
+ '/((x)/' => 'Unmatched ( before {#} mark in regex m/({#}(x)/',
 
- "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 at {#} mark in regex m/x{{#}$inf_p1}/",
+ "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 before {#} mark in regex m/x{{#}$inf_p1}/",
 
- '/x{3,1}/' => 'Can\'t do {n,m} with n > m at {#} mark in regex m/x{3,1}{#}/',
+ '/x{3,1}/' => 'Can\'t do {n,m} with n > m before {#} mark in regex m/x{3,1}{#}/',
 
- '/x**/' => 'Nested quantifiers at {#} mark in regex m/x**{#}/',
+ '/x**/' => 'Nested quantifiers before {#} mark in regex m/x**{#}/',
 
- '/x[/' => 'Unmatched [ at {#} mark in regex m/x[{#}/',
+ '/x[/' => 'Unmatched [ before {#} mark in regex m/x[{#}/',
 
- '/*/', => 'Quantifier follows nothing at {#} mark in regex m/*{#}/',
+ '/*/', => 'Quantifier follows nothing before {#} mark in regex m/*{#}/',
 
- '/\p{x/' => 'Missing right brace on \p{} at {#} mark in regex m/\p{{#}x/',
+ '/\p{x/' => 'Missing right brace on \p{} before {#} mark in regex m/\p{{#}x/',
 
- 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} at {#} mark in regex m/[\p{{#}x]/',
+ 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} before {#} mark in regex m/[\p{{#}x]/',
 
- '/(x)\2/' => 'Reference to nonexistent group at {#} mark in regex m/(x)\2{#}/',
+ '/(x)\2/' => 'Reference to nonexistent group before {#} mark in regex m/(x)\2{#}/',
 
- 'my $m = chr(92); $m =~ $m', => 'Trailing \ in regex m/\/',
+ 'my $m = "\\\"; $m =~ $m', => 'Trailing \ in regex m/\/',
 
- '/\x{1/' => 'Missing right brace on \x{} at {#} mark in regex m/\x{{#}1/',
+ '/\x{1/' => 'Missing right brace on \x{} before {#} mark in regex m/\x{{#}1/',
 
- 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} at {#} mark in regex m/[\x{{#}X]/',
+ 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} before {#} mark in regex m/[\x{{#}X]/',
 
- '/\x{x}/' => 'Can\'t use \x{} without \'use utf8\' declaration at {#} mark in regex m/\x{x}{#}/',
+ '/[[:barf:]]/' => 'POSIX class [:barf:] unknown before {#} mark in regex m/[[:barf:]{#}]/',
 
- '/[[:barf:]]/' => 'POSIX class [:barf:] unknown at {#} mark in regex m/[[:barf:]{#}]/',
+ '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=barf=]{#}]/',
 
- '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions at {#} mark in regex m/[[=barf=]{#}]/',
-
- '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions at {#} mark in regex m/[[.barf.]{#}]/',
+ '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions before {#} mark in regex m/[[.barf.]{#}]/',
   
- '/[z-a]/' => 'Invalid [] range "z-a" at {#} mark in regex m/[z-a{#}]/',
+ '/[z-a]/' => 'Invalid [] range "z-a" before {#} mark in regex m/[z-a{#}]/',
 );
 
 ##
 ## Key-value pairs of code/error of code that should have non-fatal warnings.
 ##
 @warning = (
-    "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) at {#} mark in regex m/(?p{#}{ 'a' })/",
+    "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) before {#} mark in regex m/(?p{#}{ 'a' })/",
 
-    'm/\b*/' => '\b* matches null string many times at {#} mark in regex m/\b*{#}/',
+    'm/\b*/' => '\b* matches null string many times before {#} mark in regex m/\b*{#}/',
 
-    'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes at {#} mark in regex m/[:blank:]{#}/',
+    'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes before {#} mark in regex m/[:blank:]{#}/',
 
-    "m'[\\y]'"     => 'Unrecognized escape \y in character class passed through at {#} mark in regex m/[\y{#}]/',
+    "m'[\\y]'"     => 'Unrecognized escape \y in character class passed through before {#} mark in regex m/[\y{#}]/',
 
-    'm/[a-\d]/' => 'False [] range "a-\d" at {#} mark in regex m/[a-\d{#}]/',
-    'm/[\w-x]/' => 'False [] range "\w-" at {#} mark in regex m/[\w-{#}x]/',
-    "m'\\y'"     => 'Unrecognized escape \y passed through at {#} mark in regex m/\y{#}/',
+    'm/[a-\d]/' => 'False [] range "a-\d" before {#} mark in regex m/[a-\d{#}]/',
+    'm/[\w-x]/' => 'False [] range "\w-" before {#} mark in regex m/[\w-{#}x]/',
+    "m'\\y'"     => 'Unrecognized escape \y passed through before {#} mark in regex m/\y{#}/',
 );
 
 my $total = (@death + @warning)/2;
 
+# utf8 is a noop on EBCDIC platforms, it is not fatal
+my $Is_EBCDIC = (ord('A') == 193);
+if ($Is_EBCDIC) {
+    my @utf8_death = grep(/utf8/, @death); 
+    $total = $total - @utf8_death;
+}
+
 print "1..$total\n";
 
 my $count = 0;
 
 while (@death)
 {
-    $count++;
     my $regex = shift @death;
     my $result = shift @death;
+    # skip the utf8 test on EBCDIC since they do not die
+    next if ($Is_EBCDIC && $regex =~ /utf8/);
+    $count++;
 
     $_ = "x";
     eval $regex;