summaryrefslogtreecommitdiff
path: root/t/lib/warnings/util
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/warnings/util')
-rw-r--r--t/lib/warnings/util50
1 files changed, 50 insertions, 0 deletions
diff --git a/t/lib/warnings/util b/t/lib/warnings/util
index e82d6a6617..4e960c1ea1 100644
--- a/t/lib/warnings/util
+++ b/t/lib/warnings/util
@@ -106,3 +106,53 @@ no warnings 'portable' ;
$a = oct "0047777777777" ;
EXPECT
Octal number > 037777777777 non-portable at - line 5.
+########
+# util.c
+use warnings;
+$x = 1;
+if ($x) {
+ print $y;
+}
+EXPECT
+Name "main::y" used only once: possible typo at - line 5.
+Use of uninitialized value in print at - line 5.
+########
+# util.c
+use warnings;
+$x = 1;
+if ($x) {
+ $x++;
+ print $y;
+}
+EXPECT
+Name "main::y" used only once: possible typo at - line 6.
+Use of uninitialized value in print at - line 6.
+########
+# util.c
+use warnings;
+$x = 0;
+if ($x) {
+ print "1\n";
+} elsif (!$x) {
+ print $y;
+} else {
+ print "0\n";
+}
+EXPECT
+Name "main::y" used only once: possible typo at - line 7.
+Use of uninitialized value in print at - line 7.
+########
+# util.c
+use warnings;
+$x = 0;
+if ($x) {
+ print "1\n";
+} elsif (!$x) {
+ $x++;
+ print $y;
+} else {
+ print "0\n";
+}
+EXPECT
+Name "main::y" used only once: possible typo at - line 8.
+Use of uninitialized value in print at - line 8.