Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/t/lib/warnings/4lint

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Check lint

__END__
-W
# lint: check compile time $^W is zapped
BEGIN { $^W = 0 ;}
$a = 1 ;
$a =+ 1 ;
close STDIN ; print STDIN "abc" ;
EXPECT
Reversed += operator at - line 5.
print() on closed filehandle STDIN at - line 6.
########
-W
# lint: check runtime $^W is zapped
$^W = 0 ;
close STDIN ; print STDIN "abc" ;
EXPECT
print() on closed filehandle STDIN at - line 4.
########
-W
# lint: check runtime $^W is zapped
{
  $^W = 0 ;
  close STDIN ; print STDIN "abc" ;
}
EXPECT
print() on closed filehandle STDIN at - line 5.
########
-W
# lint: check "no warnings" is zapped
no warnings ;
$a = 1 ;
$a =+ 1 ;
close STDIN ; print STDIN "abc" ;
EXPECT
Reversed += operator at - line 5.
print() on closed filehandle STDIN at - line 6.
########
-W
# lint: check "no warnings" is zapped
{
  no warnings ;
  close STDIN ; print STDIN "abc" ;
}
EXPECT
print() on closed filehandle STDIN at - line 5.
########
-Ww
# lint: check combination of -w and -W
{
  $^W = 0 ;
  close STDIN ; print STDIN "abc" ;
}
EXPECT
print() on closed filehandle STDIN at - line 5.
########
-W
--FILE-- abc.pm
package abc;
no warnings 'syntax' ;
my $a = 0;
$a =+ 1 ;
1;
--FILE-- 
no warnings 'uninitialized' ;
use abc;
my $a ; chop $a ;
EXPECT
Reversed += operator at abc.pm line 4.
Use of uninitialized value in scalar chop at - line 3.
########
-W
--FILE-- abc
package abc;
no warnings 'syntax' ;
my $a = 0;
$a =+ 1 ;
1;
--FILE-- 
no warnings 'uninitialized' ;
require "./abc";
my $a ; chop $a ;
EXPECT
Reversed += operator at ./abc line 4.
Use of uninitialized value in scalar chop at - line 3.
########
-W
--FILE-- abc.pm
package abc;
BEGIN {$^W = 0}
my $a = 0 ;
$a =+ 1 ;
1;
--FILE-- 
$^W = 0 ;
use abc;
my $a ; chop $a ;
EXPECT
Reversed += operator at abc.pm line 4.
Use of uninitialized value in scalar chop at - line 3.
########
-W
--FILE-- abc
BEGIN {$^W = 0}
my $a = 0 ;
$a =+ 1 ;
1;
--FILE-- 
$^W = 0 ;
require "./abc";
my $a ; chop $a ;
EXPECT
Reversed += operator at ./abc line 3.
Use of uninitialized value in scalar chop at - line 3.
########
-W
# Check scope of pragma with eval
{
    no warnings ;
    eval '
        my $b ; chop $b ;
    '; print STDERR $@ ;
    my $b ; chop $b ;
}
EXPECT
Use of uninitialized value in scalar chop at (eval 1) line 2.
Use of uninitialized value in scalar chop at - line 8.
########
-W
# Check scope of pragma with eval
use warnings;
{
    no warnings ;
    eval q[ 
        use warnings 'uninitialized' ;
        my $b ; chop $b ;
    ]; print STDERR $@;
    my $b ; chop $b ;
}
EXPECT
Use of uninitialized value in scalar chop at (eval 1) line 3.
Use of uninitialized value in scalar chop at - line 10.
########
-W
# Check scope of pragma with eval
no warnings;
{
    use warnings 'uninitialized' ;
    eval '
        my $b ; chop $b ;
    '; print STDERR $@ ;
    my $b ; chop $b ;
}
EXPECT
Use of uninitialized value in scalar chop at (eval 1) line 2.
Use of uninitialized value in scalar chop at - line 9.
########
-W
# Check scope of pragma with eval
no warnings;
{
    use warnings 'uninitialized' ;
    eval '
        no warnings ;
        my $b ; chop $b ;
    '; print STDERR $@ ;
    my $b ; chop $b ;
}
EXPECT
Use of uninitialized value in scalar chop at (eval 1) line 3.
Use of uninitialized value in scalar chop at - line 10.
########
-W
# Check scope of pragma with eval
use warnings;
{
    my $a = "1"; my $b = "2";
    no warnings ;
    eval q[ 
        use warnings 'syntax' ;
        $a =+ 1 ;
    ]; print STDERR $@;
    $a =+ 1 ;
}
EXPECT
Reversed += operator at - line 11.
Reversed += operator at (eval 1) line 3.
########
-W
# Check scope of pragma with eval
no warnings;
{
    my $a = "1"; my $b = "2";
    use warnings 'syntax' ;
    eval '
        $a =+ 1 ;
    '; print STDERR $@;
    $a =+ 1 ;
}
EXPECT
Reversed += operator at - line 10.
Reversed += operator at (eval 1) line 2.
########
-W
# Check scope of pragma with eval
no warnings;
{
    my $a = "1"; my $b = "2";
    use warnings 'syntax' ;
    eval '
        no warnings ;
        $a =+ 1 ;
    '; print STDERR $@;
    $a =+ 1 ;
}
EXPECT
Reversed += operator at - line 11.
Reversed += operator at (eval 1) line 3.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].