perl

 view release on metacpan or  search on metacpan

t/lib/warnings/toke  view on Meta::CPAN

        *foo *foo

__END__
use utf8;
use open qw( :utf8 :std );
use warnings;
eval "sub fòò (@\$\0) {}";
EXPECT
Prototype after '@' for main::fòò : @$\0 at (eval 1) line 1.
Illegal character in prototype for main::fòò : @$\0 at (eval 1) line 1.
########
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
Missing ']' in prototype for bar::foo : [ at (eval 1) line 1.
########
# toke.c
$a =~ m/$foo/eq;
$a =~ s/$foo/fool/seq;

EXPECT
OPTION fatal
Unknown regexp modifier "/e" at - line 2, near "=~ "
Unknown regexp modifier "/q" at - line 2, near "=~ "
Unknown regexp modifier "/q" at - line 3, near "=~ "
########
# toke.c
use utf8;
use open qw( :utf8 :std );
$a =~ m/$foo/eネq;
$a =~ s/$foo/fool/seネq;

EXPECT
OPTION fatal
Unknown regexp modifier "/e" at - line 4, near "=~ "
Unknown regexp modifier "/ネ" at - line 4, near "=~ "
Unknown regexp modifier "/q" at - line 4, near "=~ "
Unknown regexp modifier "/ネ" at - line 5, near "=~ "
Unknown regexp modifier "/q" at - line 5, near "=~ "
########
# toke.c
use warnings 'syntax' ;
s/(abc)/\1/;
no warnings 'syntax' ;
s/(abc)/\1/;
EXPECT
\1 better written as $1 at - line 3.
########
# toke.c
use warnings 'semicolon' ;
$a = 1
&time ;
no warnings 'semicolon' ;
$a = 1
&time ;
EXPECT
Semicolon seems to be missing at - line 3.
########
# toke.c
use warnings 'syntax' ;
my $a =+ 2 ;
$a =- 2 ;
$a =* 2 ;
$a =% 2 ;
$a =& 2 ;



( run in 8.052 seconds using v1.01-cache-2.11-cpan-b301d465b3d )