summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-04-27 10:20:10 +0000
committerNicholas Clark <nick@ccl4.org>2008-04-27 10:20:10 +0000
commitd12f7a6a491a8bf98b22bd9b6e1a5ee0d9f48c4b (patch)
tree2ecfe8913dbeca74c4ef8e56f1304bda48e79ec8 /t
parent05bc20f3049bc9fc0c4874ea91065f8f6d00d4b5 (diff)
downloadperl-d12f7a6a491a8bf98b22bd9b6e1a5ee0d9f48c4b.tar.gz
Warnings within the conditional of until() and for() are not reported
with the correct line number. (See change 33756). Curiously, warnings for the third expression of for() have the correct line number. p4raw-id: //depot/perl@33758
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/9uninit43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit
index b1c2a4fcc6..09bd371c04 100644
--- a/t/lib/warnings/9uninit
+++ b/t/lib/warnings/9uninit
@@ -1348,6 +1348,49 @@ EXPECT
Use of uninitialized value $c in numeric eq (==) at - line 5.
Use of uninitialized value $c in numeric eq (==) at - line 5.
########
+# TODO long standing bug - conditions of until loops
+use warnings;
+
+my $c;
+my $d;
+until ($c == 1) {
+ # a
+ # few
+ # blank
+ # lines
+ $c = 1 if ++$d == 2;
+}
+EXPECT
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+########
+# TODO long standing bug - conditions of for loops
+use warnings;
+
+my $c;
+my $d;
+for ($d = 1; $c == 0 && $d; ) {
+ # a
+ # few
+ # blank
+ # lines
+ undef $d;
+}
+
+my $e;
+for ($d = 2; $d > 0; $e = !($c == 0)) {
+ # a
+ # few
+ # blank
+ # lines
+ --$d;
+}
+EXPECT
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+Use of uninitialized value $c in numeric eq (==) at - line 5.
+Use of uninitialized value $c in numeric eq (==) at - line 14.
+Use of uninitialized value $c in numeric eq (==) at - line 14.
+########
# TODO long standing bug - more general variant of the above problem
use warnings;
my $undef;