This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change error wording for \o{}
[perl5.git] / t / lib / warnings / toke
index 1bbbb3c..faaf5bc 100644 (file)
@@ -2,10 +2,11 @@ toke.c        AOK
 
     we seem to have lost a few ambiguous warnings!!
 
-               $a = <<;
-               Use of comma-less variable list is deprecated. Its use will be fatal in Perl 5.28
-               (called 3 times via depcom)
+     Prototype after '@' for main::foo
+       sub foo (@$)
+
+     Illegal character in prototype for main::foo
+       sub foo (x)
 
      \1 better written as $1 
        use warnings 'syntax' ;
@@ -53,6 +54,11 @@ toke.c       AOK
        printf ("")
        sort ("")
 
+     Old package separator used in string
+       "$foo'bar"
+       "@foo'bar"
+       "$#foo'bar"
+
      Ambiguous use of %c{%s%s} resolved to %c%s%s 
        $a = ${time[2]}
        $a = ${time{2}}
@@ -103,8 +109,6 @@ toke.c      AOK
         $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///
@@ -125,38 +129,74 @@ toke.c    AOK
         *foo *foo
 
 __END__
-# toke.c 
-format STDOUT =
-@<<<  @|||  @>>>  @>>>
-$a    $b    "abc" 'def'
-.
-no warnings 'deprecated' ;
-format STDOUT =
-@<<<  @|||  @>>>  @>>>
-$a    $b    "abc" 'def'
-.
-EXPECT
-Use of comma-less variable list is deprecated. Its use will be fatal in Perl 5.28 at - line 4.
-Use of comma-less variable list is deprecated. Its use will be fatal in Perl 5.28 at - line 4.
-Use of comma-less variable list is deprecated. Its use will be fatal in Perl 5.28 at - line 4.
-########
-# toke.c
-$a = <<;
-
-no warnings 'deprecated' ;
-$a = <<;
-
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+eval "sub fòò (@\$\0) {}";
 EXPECT
-Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 at - line 2.
+Prototype after '@' for main::fòò : @$\0 at (eval 1) line 1.
+Illegal character in prototype for main::fòò : @$\0 at (eval 1) line 1.
 ########
-# toke.c
-$a = <<~;
-
-$a = <<~ ;
-
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+eval "sub foo (@\0) {}";
+eval "sub foo2 :prototype(@\0) {}";
+EXPECT
+Prototype after '@' for main::foo : @\0 at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\0 at (eval 1) line 1.
+Prototype after '@' for main::foo2 : @\x{0} at (eval 2) line 1.
+Illegal character in prototype for main::foo2 : @\x{0} at (eval 2) line 1.
+########
+BEGIN {
+    if (ord('A') == 193) {
+        print "SKIPPED\n# Different results on EBCDIC";
+        exit 0;
+    }
+}
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { $::{"foo"} = "\@\$\0L\351on" }
+BEGIN { eval "sub foo (@\$\0L\x{c3}\x{a9}on) {}"; }
+EXPECT
+Prototype after '@' for main::foo : @$\x{0}L... at (eval 1) line 1.
+Illegal character in prototype for main::foo : @$\x{0}L... at (eval 1) line 1.
+########
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { eval "sub foo (@\0) {}"; }
+EXPECT
+Prototype after '@' for main::foo : @\0 at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\0 at (eval 1) line 1.
+########
+use warnings;
+eval "sub foo (@\xAB) {}";
+EXPECT
+Prototype after '@' for main::foo : @\x{ab} at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\x{ab} at (eval 1) line 1.
+########
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+BEGIN { eval "sub foo (@\x{30cb}) {}"; }
+EXPECT
+Prototype after '@' for main::foo : @\x{30cb} at (eval 1) line 1.
+Illegal character in prototype for main::foo : @\x{30cb} at (eval 1) line 1.
+########
+use warnings;
+sub f ([);
+sub f :prototype([)
+EXPECT
+Missing ']' in prototype for main::f : [ at - line 2.
+Missing ']' in prototype for main::f : [ at - line 3.
+########
+use warnings;
+package bar { sub bar { eval q"sub foo ([)" } }
+bar::bar
 EXPECT
-Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 at - line 2.
-Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 at - line 4.
+Missing ']' in prototype for bar::foo : [ at (eval 1) line 1.
 ########
 # toke.c
 $a =~ m/$foo/eq;
@@ -375,6 +415,40 @@ sort ("")
 EXPECT
 
 ########
+use warnings 'syntax';
+@foo::bar = 1..3;
+() = "$foo'bar";
+() = "@foo'bar";
+() = "$#foo'bar";
+no warnings 'syntax' ;
+() = "$foo'bar";
+() = "@foo'bar";
+() = "$#foo'bar";
+EXPECT
+Old package separator used in string at - line 3.
+       (Did you mean "$foo\'bar" instead?)
+Old package separator used in string at - line 4.
+       (Did you mean "@foo\'bar" instead?)
+Old package separator used in string at - line 5.
+       (Did you mean "$#foo\'bar" instead?)
+########
+use warnings 'syntax'; use utf8;
+@fooл::barл = 1..3;
+() = "$fooл'barл";
+() = "@fooл'barл";
+() = "$#fooл'barл";
+no warnings 'syntax' ;
+() = "$fooл'barл";
+() = "@fooл'barл";
+() = "$#fooл'barл";
+EXPECT
+Old package separator used in string at - line 3.
+       (Did you mean "$fooл\'barл" instead?)
+Old package separator used in string at - line 4.
+       (Did you mean "@fooл\'barл" instead?)
+Old package separator used in string at - line 5.
+       (Did you mean "$#fooл\'barл" instead?)
+########
 # toke.c
 use warnings 'ambiguous' ;
 $a = ${time[2]};
@@ -677,6 +751,34 @@ _123
 12340000000000
 ########
 # toke.c
+use warnings 'syntax';
+$a = 1_; print "$a\n";
+$a = 01_; print "$a\n";
+$a = 0_; print "$a\n";
+$a = 0x1_; print "$a\n";
+$a = 0x_; print "$a\n";
+$a = 1.2_; print "$a\n";
+$a = 1._2; print "$a\n";
+$a = 1._; print "$a\n";
+EXPECT
+Misplaced _ in number at - line 3.
+Misplaced _ in number at - line 4.
+Misplaced _ in number at - line 5.
+Misplaced _ in number at - line 6.
+Misplaced _ in number at - line 7.
+Misplaced _ in number at - line 8.
+Misplaced _ in number at - line 9.
+Misplaced _ in number at - line 10.
+1
+1
+0
+1
+0
+1.2
+1.2
+1
+########
+# toke.c
 use warnings 'bareword' ;
 #line 25 "bar"
 $a = FRED:: ;
@@ -926,6 +1028,7 @@ Operator or semicolon missing before *foo at - line 8.
 Ambiguous use of * resolved as operator * at - line 8.
 Operator or semicolon missing before *foo at - line 10.
 Ambiguous use of * resolved as operator * at - line 10.
+$* is no longer supported as of Perl 5.30 at - line 14.
 ########
 # toke.c
 $^W = 0 ;
@@ -1077,23 +1180,6 @@ 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 overridden dump\n"; }
-dump;
-EXPECT
-no warning for overridden dump
-########
-# toke.c
 use warnings 'ambiguous';
 "@mjd_previously_unused_array";        
 no warnings 'ambiguous';
@@ -1222,26 +1308,6 @@ EXPECT
 !=~ should be !~ at - line 9.
 ########
 # toke.c
-our $foo :unique;
-sub pam :locked;
-sub glipp :locked {
-}
-sub whack_eth ($) : locked {
-}
-no warnings 'deprecated';
-our $bar :unique;
-sub zapeth :locked;
-sub ker_plop :locked {
-}
-sub swa_a_p ($) : locked {
-}
-EXPECT
-Attribute "unique" is deprecated, and will disappear in Perl 5.28 at - line 2.
-Attribute "locked" is deprecated, and will disappear in Perl 5.28 at - line 3.
-Attribute "locked" is deprecated, and will disappear in Perl 5.28 at - line 4.
-Attribute "locked" is deprecated, and will disappear in Perl 5.28 at - line 6.
-########
-# toke.c
 use warnings "syntax";
 sub proto_after_array(@$);
 sub proto_after_arref(\@$);
@@ -1252,7 +1318,7 @@ sub proto_after_hashref(\%$);
 sub proto_after_hashref2(\[%$]);
 sub underscore_last_pos($_);
 sub underscore2($_;$);
-sub underscore_fail($_$);
+sub underscore_fail($_$); sub underscore_fail2 : prototype($_$);
 sub underscore_after_at(@_);
 our sub hour (@$);
 my sub migh (@$);
@@ -1270,6 +1336,7 @@ EXPECT
 Prototype after '@' for main::proto_after_array : @$ at - line 3.
 Prototype after '%' for main::proto_after_hash : %$ at - line 7.
 Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12.
+Illegal character after '_' in prototype for main::underscore_fail2 : $_$ at - line 12.
 Prototype after '@' for main::underscore_after_at : @_ at - line 13.
 Prototype after '@' for hour : @$ at - line 14.
 Prototype after '@' for migh : @$ at - line 15.
@@ -1305,7 +1372,7 @@ my $a = "\o{}";
 EXPECT
 Missing braces on \o{} at - line 3, within string
 Missing right brace on \o{ at - line 4, within string
-Number with no digits at - line 5, within string
+Empty \o{} at - line 5, within string
 BEGIN not safe after errors--compilation aborted at - line 6.
 ########
 # toke.c
@@ -1574,4 +1641,37 @@ BEGIN{
 use utf8;
 my $a = qr ̂foobar̂;
 EXPECT
-Use of unassigned code point or non-standalone grapheme for a delimiter will be a fatal error starting in Perl v5.30 at - line 8.
+Use of unassigned code point or non-standalone grapheme for a delimiter is not allowed at - line 8, near "= "
+Use of unassigned code point or non-standalone grapheme for a delimiter is not allowed at - line 8, near "= "
+Execution of - aborted due to compilation errors.
+########
+# NAME  [perl #130567] Assertion failure
+BEGIN {
+    if (ord('A') != 65) {
+        print "SKIPPED\n# test is ASCII-specific";
+        exit 0;
+    }
+}
+no warnings "uninitialized";
+$_= "";
+s//\3000/;
+s//"\x{180};;s\221(*$@$`\241\275";/gee;
+s//"s\221\302\302\302\302\302\302\302$@\241\275";/gee;
+EXPECT
+########
+# NAME  [perl #130666] Assertion failure
+no warnings "uninitialized";
+BEGIN{$^H=-1};my $l; s\0$0[$l]\0\0
+EXPECT
+########
+# NAME  [perl #129036] Assertion failure
+BEGIN{$0="";$^H=hex join""=>A00000}p?
+EXPECT
+OPTION fatal
+syntax error at - line 1, at EOF
+Execution of - aborted due to compilation errors.
+########
+# NAME  [perl #130655]
+use utf8;
+qw∘foo ∞ ♥ bar∘
+EXPECT