This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove obsolete test for the deprecation warning I just removed.
[perl5.git] / t / op / regmesg.t
index 50a020b..4e8f3c4 100644 (file)
@@ -13,8 +13,8 @@ my $debug = 1;
 ## arrays below. The {#} is a meta-marker -- it marks where the marker should
 ## go.
 
 ## 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.
 
 ##
 ## Key-value pairs of code/error of code that should have fatal errors.
@@ -26,75 +26,88 @@ my $inf_m1 = ($Config{reg_infty} || 32767) - 1;
 my $inf_p1 = $inf_m1 + 2;
 my @death =
 (
 my $inf_p1 = $inf_m1 + 2;
 my @death =
 (
- '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=foo=]{#}]/',
+ '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions in regex; marked by {#} in m/[[=foo=]{#}]/',
 
 
- '/(?<= .*)/' =>  'Variable length lookbehind not implemented before {#} mark in regex m/(?<= .*){#}/',
+ '/(?<= .*)/' =>  'Variable length lookbehind not implemented in regex m/(?<= .*)/',
 
 
- '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented before {#} mark in regex m/(?<= x{1000}){#}/',
+ '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented in regex m/(?<= x{1000})/',
 
 
- '/(?@)/' => 'Sequence (?@...) not implemented before {#} mark in regex m/(?@{#})/',
+ '/(?@)/' => 'Sequence (?@...) not implemented in regex; marked by {#} in m/(?@{#})/',
 
 
- '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced before {#} mark in regex m/(?{{#} 1/',
+ '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced in regex; marked by {#} in m/(?{{#} 1/',
 
 
- '/(?(1x))/' => 'Switch condition not recognized before {#} mark in regex m/(?(1x{#}))/',
+ '/(?(1x))/' => 'Switch condition not recognized in regex; marked by {#} in m/(?(1x{#}))/',
 
 
- '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches before {#} mark in regex m/(?(1)x|y|{#}z)/',
+ '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches in regex; marked by {#} in m/(?(1)x|y|{#}z)/',
 
 
- '/(?(x)y|x)/' => 'Unknown switch condition (?(x) before {#} mark in regex m/(?({#}x)y|x)/',
+ '/(?(x)y|x)/' => 'Unknown switch condition (?(x) in regex; marked by {#} in m/(?({#}x)y|x)/',
 
 
- '/(?/' => 'Sequence (? incomplete before {#} mark in regex m/(?{#}/',
+ '/(?/' => 'Sequence (? incomplete in regex; marked by {#} in m/(?{#}/',
 
 
- '/(?;x/' => 'Sequence (?;...) not recognized before {#} mark in regex m/(?;{#}x/',
- '/(?<;x/' => 'Sequence (?<;...) not recognized before {#} mark in regex m/(?<;{#}x/',
+ '/(?;x/' => 'Sequence (?;...) not recognized in regex; marked by {#} in m/(?;{#}x/',
+ '/(?<;x/' => 'Sequence (?<;...) not recognized in regex; marked by {#} in m/(?<;{#}x/',
 
 
- '/((x)/' => 'Unmatched ( before {#} mark in regex m/({#}(x)/',
+ '/(?\ix/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}ix/',
+ '/(?\mx/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}mx/',
+ '/(?\:x/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}:x/',
+ '/(?\=x/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}=x/',
+ '/(?\!x/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}!x/',
+ '/(?\<=x/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}<=x/',
+ '/(?\<!x/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}<!x/',
+ '/(?\>x/' => 'Sequence (?\...) not recognized in regex; marked by {#} in m/(?\{#}>x/',
 
 
"/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 before {#} mark in regex m/x{{#}$inf_p1}/",
'/((x)/' => 'Unmatched ( in regex; marked by {#} in m/({#}(x)/',
 
 
'/x{3,1}/' => 'Can\'t do {n,m} with n > m before {#} mark in regex m/x{3,1}{#}/',
"/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 in regex; marked by {#} in m/x{{#}$inf_p1}/",
 
 
- '/x**/' => 'Nested quantifiers before {#} mark in regex m/x**{#}/',
+ '/x{3,1}/' => 'Can\'t do {n,m} with n > m in regex; marked by {#} in m/x{3,1}{#}/',
 
 
- '/x[/' => 'Unmatched [ before {#} mark in regex m/x[{#}/',
+ '/x**/' => 'Nested quantifiers in regex; marked by {#} in m/x**{#}/',
 
 
- '/*/', => 'Quantifier follows nothing before {#} mark in regex m/*{#}/',
+ '/x[/' => 'Unmatched [ in regex; marked by {#} in m/x[{#}/',
 
 
- '/\p{x/' => 'Missing right brace on \p{} before {#} mark in regex m/\p{{#}x/',
+ '/*/', => 'Quantifier follows nothing in regex; marked by {#} in m/*{#}/',
 
 
- 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} before {#} mark in regex m/[\p{{#}x]/',
+ '/\p{x/' => 'Missing right brace on \p{} in regex; marked by {#} in m/\p{{#}x/',
 
 
- '/(x)\2/' => 'Reference to nonexistent group before {#} mark in regex m/(x)\2{#}/',
+ '/[\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{#}/',
 
  'my $m = "\\\"; $m =~ $m', => 'Trailing \ in regex m/\/',
 
 
  'my $m = "\\\"; $m =~ $m', => 'Trailing \ in regex m/\/',
 
- '/\x{1/' => 'Missing right brace on \x{} before {#} mark in regex m/\x{{#}1/',
+ '/\x{1/' => 'Missing right brace on \x{} in regex; marked by {#} in m/\x{{#}1/',
 
 
- 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} before {#} mark in regex m/[\x{{#}X]/',
+ '/[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/',
 
 
- '/[[:barf:]]/' => 'POSIX class [:barf:] unknown before {#} mark in regex m/[[:barf:]{#}]/',
+ '/[[:barf:]]/' => 'POSIX class [:barf:] unknown in regex; marked by {#} in m/[[:barf:]{#}]/',
 
 
- '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=barf=]{#}]/',
+ '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions in regex; marked by {#} in m/[[=barf=]{#}]/',
 
 
- '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions before {#} mark in regex m/[[.barf.]{#}]/',
+ '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions in regex; marked by {#} in m/[[.barf.]{#}]/',
   
   
- '/[z-a]/' => 'Invalid [] range "z-a" before {#} mark in regex m/[z-a{#}]/',
+ '/[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{{#}}/',
 );
 
 ##
 ## Key-value pairs of code/error of code that should have non-fatal warnings.
 ##
 @warning = (
 );
 
 ##
 ## Key-value pairs of code/error of code that should have non-fatal warnings.
 ##
 @warning = (
-    "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) before {#} mark in regex m/(?p{#}{ 'a' })/",
-
-    'm/\b*/' => '\b* matches null string many times before {#} mark in regex m/\b*{#}/',
+    'm/\b*/' => '\b* matches null string many times in regex; marked by {#} in m/\b*{#}/',
 
 
-    'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes before {#} mark in regex m/[:blank:]{#}/',
+    'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes in regex; marked by {#} in m/[:blank:]{#}/',
 
 
-    "m'[\\y]'"     => 'Unrecognized escape \y in character class passed through before {#} mark in regex m/[\y{#}]/',
+    "m'[\\y]'"     => 'Unrecognized escape \y in character class passed through in regex; marked by {#} in 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{#}/',
+    '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{#}/',
 );
 
 my $total = (@death + @warning)/2;
 );
 
 my $total = (@death + @warning)/2;
@@ -103,7 +116,7 @@ my $total = (@death + @warning)/2;
 my $Is_EBCDIC = (ord('A') == 193);
 if ($Is_EBCDIC) {
     my @utf8_death = grep(/utf8/, @death); 
 my $Is_EBCDIC = (ord('A') == 193);
 if ($Is_EBCDIC) {
     my @utf8_death = grep(/utf8/, @death); 
-    $total = $total - $#utf8_death;
+    $total = $total - @utf8_death;
 }
 
 print "1..$total\n";
 }
 
 print "1..$total\n";
@@ -127,10 +140,11 @@ while (@death)
     chomp $@;
     $result =~ s/{\#}/$marker1/;
     $result =~ s/{\#}/$marker2/;
     chomp $@;
     $result =~ s/{\#}/$marker1/;
     $result =~ s/{\#}/$marker2/;
+    $result .= " at ";
     if ($@ !~ /^\Q$result/) {
        print "# For $regex, expected:\n#  $result\n# Got:\n#  $@\n#\nnot ";
     }
     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 +174,7 @@ while (@warning)
     }
     $result =~ s/{\#}/$marker1/;
     $result =~ s/{\#}/$marker2/;
     }
     $result =~ s/{\#}/$marker1/;
     $result =~ s/{\#}/$marker2/;
+    $result .= " at ";
     if ($warning !~ /^\Q$result/)
     {
        print <<"EOM";
     if ($warning !~ /^\Q$result/)
     {
        print <<"EOM";
@@ -172,7 +187,7 @@ not ok $count
 EOM
        next;
     }
 EOM
        next;
     }
-    print "ok $count\n";
+    print "ok $count - $regex\n";
 }
 
 
 }