This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline
[perl5.git] / t / pragma / warn / toke
index 515241a..2c9433b 100644 (file)
@@ -3,12 +3,6 @@ toke.c AOK
     we seem to have lost a few ambiguous warnings!!
 
  
-               1 if $a EQ $b ;
-               1 if $a NE $b ;
-               1 if $a LT $b ;
-               1 if $a GT $b ;
-               1 if $a GE $b ;
-               1 if $a LE $b ;
                $a = <<;
                Use of comma-less variable list is deprecated 
                (called 3 times via depcom)
@@ -52,7 +46,7 @@ toke.c        AOK
      warn(warn_reserved        
        $a = abc;
 
-     chmod: mode argument is missing initial 0 
+     chmod() mode argument is missing initial 0 
        chmod 3;
 
      Possible attempt to separate words with commas 
@@ -89,14 +83,6 @@ toke.c       AOK
        sub time {} 
        my $a = time()
 
-    Use of \\x{} without utf8 declaration
-       $_ = " \x{123} " ;
-
-
-    \x%.*s will produce malformed UTF-8 character; use \x{%.*s} for that
-        use utf8 ; 
-       $_ = "\xffe"
-
     Unrecognized escape \\%c passed through
         $a = "\m" ;
 
@@ -140,29 +126,6 @@ toke.c     AOK
 __END__
 # toke.c 
 use warnings 'deprecated' ;
-1 if $a EQ $b ;
-1 if $a NE $b ;
-1 if $a GT $b ;
-1 if $a LT $b ;
-1 if $a GE $b ;
-1 if $a LE $b ;
-no warnings 'deprecated' ;
-1 if $a EQ $b ;
-1 if $a NE $b ;
-1 if $a GT $b ;
-1 if $a LT $b ;
-1 if $a GE $b ;
-1 if $a LE $b ;
-EXPECT
-Use of EQ is deprecated at - line 3.
-Use of NE is deprecated at - line 4.
-Use of GT is deprecated at - line 5.
-Use of LT is deprecated at - line 6.
-Use of GE is deprecated at - line 7.
-Use of LE is deprecated at - line 8.
-########
-# toke.c
-use warnings 'deprecated' ;
 format STDOUT =
 @<<<  @|||  @>>>  @>>>
 $a    $b    "abc" 'def'
@@ -228,12 +191,12 @@ Reversed *= operator at - line 9.
 Reversed %= operator at - line 10.
 Reversed &= operator at - line 11.
 Reversed .= operator at - line 12.
-syntax error at - line 12, near "=."
 Reversed ^= operator at - line 13.
-syntax error at - line 13, near "=^"
 Reversed |= operator at - line 14.
-syntax error at - line 14, near "=|"
 Reversed <= operator at - line 15.
+syntax error at - line 12, near "=."
+syntax error at - line 13, near "=^"
+syntax error at - line 14, near "=|"
 Unterminated <> operator at - line 15.
 ########
 # toke.c
@@ -298,39 +261,42 @@ Can't use \1 to mean $1 in expression at - line 4.
 # toke.c
 use warnings 'reserved' ;
 $a = abc;
+$a = { def
+
+=> 1 };
 no warnings 'reserved' ;
 $a = abc;
 EXPECT
 Unquoted string "abc" may clash with future reserved word at - line 3.
 ########
 # toke.c
-use warnings 'octal' ;
+use warnings 'chmod' ;
 chmod 3;
-no warnings 'octal' ;
+no warnings 'chmod' ;
 chmod 3;
 EXPECT
-chmod: mode argument is missing initial 0 at - line 3.
+chmod() mode argument is missing initial 0 at - line 3.
 ########
 # toke.c
-use warnings 'syntax' ;
+use warnings 'qw' ;
 @a = qw(a, b, c) ;
-no warnings 'syntax' ;
+no warnings 'qw' ;
 @a = qw(a, b, c) ;
 EXPECT
 Possible attempt to separate words with commas at - line 3.
 ########
 # toke.c
-use warnings 'syntax' ;
+use warnings 'qw' ;
 @a = qw(a b #) ;
-no warnings 'syntax' ;
+no warnings 'qw' ;
 @a = qw(a b #) ;
 EXPECT
 Possible attempt to put comments in qw() list at - line 3.
 ########
 # toke.c
-use warnings 'octal' ;
+use warnings 'umask' ;
 umask 3;
-no warnings 'octal' ;
+no warnings 'umask' ;
 umask 3;
 EXPECT
 umask: argument is missing initial 0 at - line 3.
@@ -421,10 +387,10 @@ Misplaced _ in number at - line 4.
 Misplaced _ in number at - line 4.
 ########
 # toke.c
-use warnings 'unsafe' ;
+use warnings 'bareword' ;
 #line 25 "bar"
 $a = FRED:: ;
-no warnings 'unsafe' ;
+no warnings 'bareword' ;
 #line 25 "bar"
 $a = FRED:: ;
 EXPECT
@@ -440,41 +406,16 @@ EXPECT
 Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
 ########
 # toke.c
-use warnings 'utf8' ;
+use warnings ;
 eval <<'EOE';
+#  line 30 "foo"
+warn "yelp";
 {
-#line 30 "foo"
   $_ = " \x{123} " ;
 }
 EOE
 EXPECT
-Use of \x{} without utf8 declaration at foo line 30.
-########
-# toke.c
-no warnings 'utf8' ;
-eval <<'EOE';
-{
-#line 30 "foo"
-  $_ = " \x{123} " ;
-}
-EOE
-EXPECT
-
-########
-# toke.c
-BEGIN {
-    if (ord("\t") == 5) {
-        print "SKIPPED\n# Ebcdic platforms have different \\x constructs.";
-        exit 0;
-    }
-}
-use warnings 'utf8' ;
-use utf8 ;
-$_ = " \xffe " ;
-no warnings 'utf8' ;
-$_ = " \xffe " ;
-EXPECT
-\xff will produce malformed UTF-8 character; use \x{ff} for that at - line 10.
+yelp at foo line 30.
 ########
 # toke.c
 my $a = rand + 4 ;
@@ -527,9 +468,9 @@ Precedence problem: open FOO should be open(FOO) at - line 2.
 $^W = 0 ;
 open FOO || time;
 {
-    no warnings 'ambiguous' ;
+    no warnings 'precedence' ;
     open FOO || time;
-    use warnings 'ambiguous' ;
+    use warnings 'precedence' ;
     open FOO || time;
 }
 open FOO || time;
@@ -557,9 +498,9 @@ Operator or semicolon missing before *foo at - line 10.
 Ambiguous use of * resolved as operator * at - line 10.
 ########
 # toke.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
 my $a = "\m" ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
 $a = "\m" ;
 EXPECT
 Unrecognized escape \m passed through at - line 3.
@@ -615,3 +556,11 @@ EXPECT
 Integer overflow in binary number at - line 5.
 Integer overflow in hexadecimal number at - line 8.
 Integer overflow in octal number at - line 11.
+########
+# 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.