Check lexical warnings functionality TODO check that the warning hierarchy works. __END__ # check illegal category is caught use warnings 'this-should-never-be-a-warning-category' ; EXPECT Unknown warnings category 'this-should-never-be-a-warning-category' at - line 3 BEGIN failed--compilation aborted at - line 3. ######## # Check compile time scope of pragma use warnings 'syntax' ; { no warnings ; my $a =+ 1 ; } my $a =+ 1 ; EXPECT Reversed += operator at - line 8. ######## # Check compile time scope of pragma no warnings; { use warnings 'syntax' ; my $a =+ 1 ; } my $a =+ 1 ; EXPECT Reversed += operator at - line 6. ######## # Check runtime scope of pragma use warnings 'uninitialized' ; { no warnings ; my $b ; chop $b ; } my $b ; chop $b ; EXPECT Use of uninitialized value in scalar chop at - line 8. ######## # Check runtime scope of pragma no warnings ; { use warnings 'uninitialized' ; my $b ; chop $b ; } my $b ; chop $b ; EXPECT Use of uninitialized value in scalar chop at - line 6. ######## # Check runtime scope of pragma no warnings ; { use warnings 'uninitialized' ; $a = sub { my $b ; chop $b ; } } &$a ; EXPECT Use of uninitialized value in scalar chop at - line 6. ######## use warnings 'syntax' ; my $a =+ 1 ; EXPECT Reversed += operator at - line 3. ######## -w no warnings 'reserved' ; foo.bar; EXPECT Useless use of concatenation (.) or string in void context at - line 3. ######## --FILE-- abc my $a =+ 1 ; 1; --FILE-- use warnings 'syntax' ; require "./abc"; EXPECT ######## --FILE-- abc use warnings 'syntax' ; 1; --FILE-- require "./abc"; my $a =+ 1 ; EXPECT ######## --FILE-- abc use warnings 'syntax' ; my $a =+ 1 ; 1; --FILE-- use warnings 'uninitialized' ; require "./abc"; my $a ; chop $a ; EXPECT Reversed += operator at ./abc line 2. Use of uninitialized value in scalar chop at - line 3. ######## --FILE-- abc.pm use warnings 'syntax' ; my $a =+ 1 ; 1; --FILE-- use warnings 'uninitialized' ; use abc; my $a ; chop $a ; EXPECT Reversed += operator at abc.pm line 2. Use of uninitialized value in scalar chop at - line 3. ######## # Check scope of pragma with eval use warnings; { no warnings ; eval { my $b ; chop $b ; }; print STDERR $@ ; my $b ; chop $b ; } EXPECT ######## # Check scope of pragma with eval use warnings; { no warnings ; eval { use warnings 'uninitialized' ; my $b ; chop $b ; }; print STDERR $@ ; my $b ; chop $b ; } EXPECT Use of uninitialized value in scalar chop at - line 8. ######## # 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 - line 7. Use of uninitialized value in scalar chop at - line 9. ######## # 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 - line 10. ######## # Check scope of pragma with eval use warnings; { no warnings ; eval { my $a =+ 1 ; }; print STDERR $@ ; my $a =+ 1 ; } EXPECT ######## # Check scope of pragma with eval use warnings; { no warnings ; eval { use warnings 'syntax' ; my $a =+ 1 ; }; print STDERR $@ ; my $a =+ 1 ; } EXPECT Reversed += operator at - line 8. ######## # Check scope of pragma with eval no warnings; { use warnings 'syntax' ; eval { my $a =+ 1 ; }; print STDERR $@ ; my $a =+ 1 ; } EXPECT Reversed += operator at - line 7. Reversed += operator at - line 9. ######## # Check scope of pragma with eval no warnings; { use warnings 'syntax' ; eval { no warnings ; my $a =+ 1 ; }; print STDERR $@ ; my $a =+ 1 ; } EXPECT Reversed += operator at - line 10. ######## # Check scope of pragma with eval use warnings; { no warnings ; eval ' my $b ; chop $b ; '; print STDERR $@ ; my $b ; chop $b ; } EXPECT ######## # 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. ######## # 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. ######## # 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 - line 10. ######## # Check scope of pragma with eval use warnings; { no warnings ; eval ' my $a =+ 1 ; '; print STDERR $@ ; my $a =+ 1 ; } EXPECT ######## # Check scope of pragma with eval use warnings; { no warnings ; eval q[ use warnings 'syntax' ; my $a =+ 1 ; ]; print STDERR $@; my $a =+ 1 ; } EXPECT Reversed += operator at (eval 1) line 3. ######## # Check scope of pragma with eval no warnings; { use warnings 'syntax' ; eval ' my $a =+ 1 ; '; print STDERR $@; my $a =+ 1 ; } EXPECT Reversed += operator at - line 9. Reversed += operator at (eval 1) line 2. ######## # Check scope of pragma with eval no warnings; { use warnings 'syntax' ; eval ' no warnings ; my $a =+ 1 ; '; print STDERR $@; my $a =+ 1 ; } EXPECT Reversed += operator at - line 10. ######## # Check the additive nature of the pragma my $a =+ 1 ; my $a ; chop $a ; use warnings 'syntax' ; $a =+ 1 ; my $b ; chop $b ; use warnings 'uninitialized' ; my $c ; chop $c ; no warnings 'syntax' ; $a =+ 1 ; EXPECT Reversed += operator at - line 6. Use of uninitialized value in scalar chop at - line 9.