Changed the underscore/undebar syntax in numeric constants;
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / toke
index 48f97dd..1776428 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,10 +83,6 @@ toke.c       AOK
        sub time {} 
        my $a = time()
 
-    \x%.*s will produce malformed UTF-8 character; use \x{%.*s} for that
-        use utf8 ; 
-       $_ = "\xffe"
-
     Unrecognized escape \\%c passed through
         $a = "\m" ;
 
@@ -136,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'
@@ -202,10 +169,6 @@ EXPECT
 Semicolon seems to be missing at - line 3.
 ########
 # toke.c
-BEGIN {
-    # Scalars leaked: due to syntax errors
-    $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
-}
 use warnings 'syntax' ;
 my $a =+ 2 ;
 $a =- 2 ;
@@ -218,25 +181,21 @@ $a =| 2 ;
 $a =< 2 ;
 $a =/ 2 ;
 EXPECT
-Reversed += operator at - line 7.
-Reversed -= operator at - line 8.
-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.
-Unterminated <> operator at - line 15.
-########
-# toke.c
-BEGIN {
-    # Scalars leaked: due to syntax errors
-    $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
-}
+Reversed += operator at - line 3.
+Reversed -= operator at - line 4.
+Reversed *= operator at - line 5.
+Reversed %= operator at - line 6.
+Reversed &= operator at - line 7.
+Reversed .= operator at - line 8.
+Reversed ^= operator at - line 9.
+Reversed |= operator at - line 10.
+Reversed <= operator at - line 11.
+syntax error at - line 8, near "=."
+syntax error at - line 9, near "=^"
+syntax error at - line 10, near "=|"
+Unterminated <> operator at - line 11.
+########
+# toke.c
 no warnings 'syntax' ;
 my $a =+ 2 ;
 $a =- 2 ;
@@ -249,10 +208,10 @@ $a =| 2 ;
 $a =< 2 ;
 $a =/ 2 ;
 EXPECT
-syntax error at - line 12, near "=."
-syntax error at - line 13, near "=^"
-syntax error at - line 14, near "=|"
-Unterminated <> operator at - line 15.
+syntax error at - line 8, near "=."
+syntax error at - line 9, near "=^"
+syntax error at - line 10, near "=|"
+Unterminated <> operator at - line 11.
 ########
 # toke.c
 use warnings 'syntax' ;
@@ -294,39 +253,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.
@@ -406,21 +368,68 @@ Ambiguous use of ${fred} resolved to $fred at - line 4.
 ########
 # toke.c
 use warnings 'syntax' ;
-$a = 1_2;
-$a = 1_2345_6;
+$a = _123;     print "$a\n"; # not a number, a string
+$a = 1_23;     print "$a\n";
+$a = 1__3;     print "$a\n"; # misplaced [ 5]
+$a = 123_;     print "$a\n"; # misplaced [ 6]
+$a = 123._456; print "$a\n"; # misplaced [ 7]
+$a = 123.4_56; print "$a\n"; 
+$a = 123.4__6; print "$a\n"; # misplaced [ 9]
+$a = 123.456_; print "$a\n"; # misplaced [10]
+$a = 0b_101;   print "$a\n"; # misplaced [11]
+$a = 0b1_01;   print "$a\n";
+$a = 0b1__1;   print "$a\n"; # misplaced [13]
+$a = 0b101_;   print "$a\n"; # misplaced [14]
+$a = 0_123;    print "$a\n"; # misplaced [15]
+$a = 01_23;    print "$a\n";
+$a = 01__3;    print "$a\n"; # misplaced [17]
+$a = 0123_;    print "$a\n"; # misplaced [18]
+$a = 0x_123;   print "$a\n"; # misplaced [19]
+$a = 0x1_23;   print "$a\n";
+$a = 0x1__3;   print "$a\n"; # misplaced [21]
+$a = 0x123_;   print "$a\n"; # misplaced [22]
 no warnings 'syntax' ;
-$a = 1_2;
-$a = 1_2345_6;
 EXPECT
-Misplaced _ in number at - line 3.
-Misplaced _ in number at - line 4.
-Misplaced _ in number at - line 4.
-########
-# toke.c
-use warnings 'unsafe' ;
+Misplaced _ in number at - line 5.
+Misplaced _ in number at - line 6.
+Misplaced _ in number at - line 7.
+Misplaced _ in number at - line 9.
+Misplaced _ in number at - line 10.
+Misplaced _ in number at - line 11.
+Misplaced _ in number at - line 13.
+Misplaced _ in number at - line 14.
+Misplaced _ in number at - line 15.
+Misplaced _ in number at - line 17.
+Misplaced _ in number at - line 18.
+Misplaced _ in number at - line 19.
+Misplaced _ in number at - line 21.
+Misplaced _ in number at - line 22.
+_123
+123
+13
+123
+123.456
+123.456
+123.46
+123.456
+5
+5
+3
+5
+83
+83
+11
+83
+291
+291
+19
+291
+########
+# toke.c
+use warnings 'bareword' ;
 #line 25 "bar"
 $a = FRED:: ;
-no warnings 'unsafe' ;
+no warnings 'bareword' ;
 #line 25 "bar"
 $a = FRED:: ;
 EXPECT
@@ -438,28 +447,14 @@ Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
 # toke.c
 use warnings ;
 eval <<'EOE';
+#  line 30 "foo"
+warn "yelp";
 {
-#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 ;
@@ -512,9 +507,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;
@@ -542,9 +537,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.
@@ -600,3 +595,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.