summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/t/lib/warnings/sv
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/t/lib/warnings/sv')
-rw-r--r--gnu/usr.bin/perl/t/lib/warnings/sv45
1 files changed, 42 insertions, 3 deletions
diff --git a/gnu/usr.bin/perl/t/lib/warnings/sv b/gnu/usr.bin/perl/t/lib/warnings/sv
index d9aa827fc8a..91398de3e83 100644
--- a/gnu/usr.bin/perl/t/lib/warnings/sv
+++ b/gnu/usr.bin/perl/t/lib/warnings/sv
@@ -112,6 +112,26 @@ Use of uninitialized value in bitwise or (|) at - line 4.
########
# sv.c
use warnings 'uninitialized' ;
+my $Y = 1 ;
+my $x = 1 & $a[$Y] ;
+no warnings 'uninitialized' ;
+my $Y = 1 ;
+$x = 1 & $b[$Y] ;
+EXPECT
+Use of uninitialized value in bitwise and (&) at - line 4.
+########
+# sv.c
+use warnings 'uninitialized' ;
+my $Y = 1 ;
+my $x = ~$a[$Y] ;
+no warnings 'uninitialized' ;
+my $Y = 1 ;
+$x = ~$b[$Y] ;
+EXPECT
+Use of uninitialized value in 1's complement (~) at - line 4.
+########
+# sv.c
+use warnings 'uninitialized' ;
my $x *= 1 ; # d
no warnings 'uninitialized' ;
my $y *= 1 ; # d
@@ -281,12 +301,12 @@ $a = sprintf "%" ;
printf F "%\x02" ;
$a = sprintf "%\x02" ;
EXPECT
-Invalid conversion in sprintf: "%z" at - line 5.
-Invalid conversion in sprintf: end of string at - line 7.
-Invalid conversion in sprintf: "%\002" at - line 9.
Invalid conversion in printf: "%z" at - line 4.
+Invalid conversion in sprintf: "%z" at - line 5.
Invalid conversion in printf: end of string at - line 6.
+Invalid conversion in sprintf: end of string at - line 7.
Invalid conversion in printf: "%\002" at - line 8.
+Invalid conversion in sprintf: "%\002" at - line 9.
########
# sv.c
use warnings 'misc' ;
@@ -345,3 +365,22 @@ no warnings 'numeric' ;
$a = "\x{100}\x{200}"; $a = -$a;
EXPECT
Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3.
+########
+# sv.c
+open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
+use warnings 'printf';
+$a = "a\nb";
+$s = sprintf "%4s", $a;
+printf F "%4s", $a;
+$s = sprintf "%-4s", $a;
+printf F "%-4s", $a;
+$s = sprintf "%*s", -4, $a;
+no warnings 'printf';
+$s = sprintf "%4s", $a;
+printf F "%4s", $a;
+$s = sprintf "%-4s", $a;
+printf F "%-4s", $a;
+EXPECT
+Newline in left-justified string for sprintf at - line 7.
+Newline in left-justified string for printf at - line 8.
+Newline in left-justified string for sprintf at - line 9.