Actually submit previous change.
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / toke
index 242b005..e4fa82c 100644 (file)
@@ -46,18 +46,12 @@ toke.c      AOK
      warn(warn_reserved        
        $a = abc;
 
-     chmod() mode argument is missing initial 0 
-       chmod 3;
-
      Possible attempt to separate words with commas 
        @a = qw(a, b, c) ;
 
      Possible attempt to put comments in qw() list 
        @a = qw(a b # c) ;
 
-     umask: argument is missing initial 0 
-       umask 3;
-
      %s (...) interpreted as function 
        print ("")
        printf ("")
@@ -107,7 +101,13 @@ toke.c     AOK
         $a =  0037777777776 ;
         $a =  0037777777777 ;
         $a =  0047777777777 ;
-     
+
+    dump() better written as CORE::dump()
+
+    Use of /c modifier is meaningless without /g     
+
+    Use of /c modifier is meaningless in s///
+
     Mandatory Warnings
     ------------------
     Use of "%s" without parentheses is ambiguous       [check_uni]
@@ -262,14 +262,6 @@ EXPECT
 Unquoted string "abc" may clash with future reserved word at - line 3.
 ########
 # toke.c
-use warnings 'chmod' ;
-chmod 3;
-no warnings 'chmod' ;
-chmod 3;
-EXPECT
-chmod() mode argument is missing initial 0 at - line 3.
-########
-# toke.c
 use warnings 'qw' ;
 @a = qw(a, b, c) ;
 no warnings 'qw' ;
@@ -286,14 +278,6 @@ EXPECT
 Possible attempt to put comments in qw() list at - line 3.
 ########
 # toke.c
-use warnings 'umask' ;
-umask 3;
-no warnings 'umask' ;
-umask 3;
-EXPECT
-umask: argument is missing initial 0 at - line 3.
-########
-# toke.c
 use warnings 'syntax' ;
 print ("")
 EXPECT
@@ -394,20 +378,20 @@ $a = -123._456; print "$a\n";             # 25
 $a = -123.4_56; print "$a\n";  
 $a = -123.45_6; print "$a\n";
 $a = -123.456_; print "$a\n";          # 28
-$a = 123.456E_12; print "$a\n";                # 29
-$a = 123.456E1_2; print "$a\n";
-$a = 123.456E12_; print "$a\n";                # 31
-$a = 123.456E_+12; print "$a\n";       # 32
-$a = 123.456E+_12; print "$a\n";       # 33
-$a = 123.456E+1_2; print "$a\n";
-$a = 123.456E+12_; print "$a\n";       # 35
+$a = 123.456E_12; printf("%.0f\n", $a);        # 29
+$a = 123.456E1_2; printf("%.0f\n", $a);
+$a = 123.456E12_; printf("%.0f\n", $a);        # 31
+$a = 123.456E_+12; printf("%.0f\n", $a);       # 32
+$a = 123.456E+_12; printf("%.0f\n", $a);       # 33
+$a = 123.456E+1_2; printf("%.0f\n", $a);
+$a = 123.456E+12_; printf("%.0f\n", $a);       # 35
 $a = 123.456E_-12; print "$a\n";       # 36
 $a = 123.456E-_12; print "$a\n";       # 37
 $a = 123.456E-1_2; print "$a\n";
 $a = 123.456E-12_; print "$a\n";       # 39
 $a = 1__23; print "$a\n";              # 40
 $a = 12.3__4; print "$a\n";            # 41
-$a = 12.34e1__2; print "$a\n";         # 42
+$a = 12.34e1__2; printf("%.0f\n", $a); # 42
 no warnings 'syntax' ;
 $a = _123; print "$a\n";
 $a = 1_23; print "$a\n";
@@ -435,20 +419,20 @@ $a = -123._456; print "$a\n";
 $a = -123.4_56; print "$a\n";
 $a = -123.45_6; print "$a\n";
 $a = -123.456_; print "$a\n";
-$a = 123.456E_12; print "$a\n";
-$a = 123.456E1_2; print "$a\n";
-$a = 123.456E12_; print "$a\n";
-$a = 123.456E_+12; print "$a\n";
-$a = 123.456E+_12; print "$a\n";
-$a = 123.456E+1_2; print "$a\n";
-$a = 123.456E+12_; print "$a\n";
+$a = 123.456E_12; printf("%.0f\n", $a);
+$a = 123.456E1_2; printf("%.0f\n", $a);
+$a = 123.456E12_; printf("%.0f\n", $a);
+$a = 123.456E_+12; printf("%.0f\n", $a);
+$a = 123.456E+_12; printf("%.0f\n", $a);
+$a = 123.456E+1_2; printf("%.0f\n", $a);
+$a = 123.456E+12_; printf("%.0f\n", $a);
 $a = 123.456E_-12; print "$a\n";
 $a = 123.456E-_12; print "$a\n";
 $a = 123.456E-1_2; print "$a\n";
 $a = 123.456E-12_; print "$a\n";
 $a = 1__23; print "$a\n";
 $a = 12.3__4; print "$a\n";
-$a = 12.34e1__2; print "$a\n";
+$a = 12.34e1__2; printf("%.0f\n", $a);
 EXPECT
 OPTIONS regex
 Misplaced _ in number at - line 6.
@@ -586,7 +570,7 @@ yelp at foo line 30.
 # toke.c
 my $a = rand + 4 ;
 EXPECT
-Warning: Use of "rand" without parens is ambiguous at - line 2.
+Warning: Use of "rand" without parentheses is ambiguous at - line 2.
 ########
 # toke.c
 $^W = 0 ;
@@ -599,9 +583,9 @@ my $a = rand + 4 ;
 }
 $a = rand + 4 ;
 EXPECT
-Warning: Use of "rand" without parens is ambiguous at - line 3.
-Warning: Use of "rand" without parens is ambiguous at - line 8.
-Warning: Use of "rand" without parens is ambiguous at - line 10.
+Warning: Use of "rand" without parentheses is ambiguous at - line 3.
+Warning: Use of "rand" without parentheses is ambiguous at - line 8.
+Warning: Use of "rand" without parentheses is ambiguous at - line 10.
 ########
 # toke.c
 sub fred {};
@@ -630,6 +614,10 @@ open FOO || time;
 EXPECT
 Precedence problem: open FOO should be open(FOO) at - line 2.
 ########
+# toke.c (and [perl #16184])
+open FOO => "<&0"; close FOO;
+EXPECT
+########
 # toke.c
 $^W = 0 ;
 open FOO || time;
@@ -724,9 +712,131 @@ Integer overflow in hexadecimal number at - line 8.
 Integer overflow in octal number at - line 11.
 ########
 # toke.c
+BEGIN { $^C = 1; }
+use warnings 'misc';
+dump;
+CORE::dump;
+EXPECT
+dump() better written as CORE::dump() at - line 4.
+- syntax OK
+########
+# toke.c
+use warnings 'misc';
+use subs qw/dump/;
+sub dump { print "no warning for overriden dump\n"; }
+dump;
+EXPECT
+no warning for overriden dump
+########
+# toke.c
 use warnings 'ambiguous';
 "@mjd_previously_unused_array";        
 no warnings 'ambiguous';
 "@mjd_previously_unused_array";        
 EXPECT
 Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
+########
+# toke.c
+# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
+use warnings 'regexp';
+"foo" =~ /foo/c;
+"foo" =~ /foo/cg;
+no warnings 'regexp';
+"foo" =~ /foo/c;
+"foo" =~ /foo/cg;
+EXPECT
+Use of /c modifier is meaningless without /g at - line 4.
+########
+# toke.c
+# 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com
+use warnings 'regexp';
+$_ = "ab" ; 
+s/ab/ab/c;
+s/ab/ab/cg;
+no warnings 'regexp';
+s/ab/ab/c;
+s/ab/ab/cg;
+EXPECT
+Use of /c modifier is meaningless in s/// at - line 5.
+Use of /c modifier is meaningless in s/// at - line 6.
+########
+-wa
+# toke.c
+# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
+print "@F\n";
+EXPECT
+
+########
+-w
+# toke.c
+# 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings
+print "@F\n";
+EXPECT
+Possible unintended interpolation of @F in string at - line 4.
+Name "main::F" used only once: possible typo at - line 4.
+########
+-wa
+# toke.c
+# 20020414 mjd-perl-patch+@plover.com
+EXPECT
+
+########
+# toke.c
+# 20020414 mjd-perl-patch+@plover.com
+# In 5.7.3, this emitted "Possible unintended interpolation" warnings
+use warnings 'ambiguous';
+$s = "(@-)(@+)";
+EXPECT
+
+########
+# toke.c
+# mandatory warning
+eval q/if ($a) { } elseif ($b) { }/;
+no warnings "syntax";
+eval q/if ($a) { } elseif ($b) { }/;
+EXPECT
+elseif should be elsif at (eval 1) line 1.
+########
+# toke.c
+# mandatory warning
+eval q/5 6/;
+no warnings "syntax";
+eval q/5 6/;
+EXPECT
+Number found where operator expected at (eval 1) line 1, near "5 6"
+       (Missing operator before  6?)
+########
+# toke.c
+use warnings "syntax";
+$_ = $a = 1;
+$a !=~  /1/;
+$a !=~ m#1#;
+$a !=~/1/;
+$a !=~ ?/?;
+$a !=~ y/1//;
+$a !=~ tr/1//;
+$a !=~ s/1//;
+$a != ~/1/;
+no warnings "syntax";
+$a !=~  /1/;
+$a !=~ m#1#;
+$a !=~/1/;
+$a !=~ ?/?;
+$a !=~ y/1//;
+$a !=~ tr/1//;
+$a !=~ s/1//;
+EXPECT
+!=~ should be !~ at - line 4.
+!=~ should be !~ at - line 5.
+!=~ should be !~ at - line 6.
+!=~ should be !~ at - line 7.
+!=~ should be !~ at - line 8.
+!=~ should be !~ at - line 9.
+!=~ should be !~ at - line 10.
+########
+# toke.c
+our $foo :unique;
+use warnings 'deprecated';
+our $bar :unique;
+EXPECT
+Use of :unique is deprecated at - line 4.