summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-02-23 17:42:09 +0000
committerSteve Peters <steve@fisharerojo.org>2006-02-23 17:42:09 +0000
commit18398057001a49d54f2e8adca16127da595f53e7 (patch)
tree9648c676ffb77b1c817c85d438103f866f79f3a0
parentee8ba3535ea90c459c94580976a3147dc3152474 (diff)
downloadperl-18398057001a49d54f2e8adca16127da595f53e7.tar.gz
Add test for RT #2166: foreach spuriously autovivifies
p4raw-id: //depot/perl@27287
-rwxr-xr-xt/cmd/for.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/cmd/for.t b/t/cmd/for.t
index 0814e7bb23..7bc188559c 100755
--- a/t/cmd/for.t
+++ b/t/cmd/for.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..78\n";
+print "1..79\n";
for ($i = 0; $i <= 10; $i++) {
$x[$i] = $i;
@@ -457,3 +457,15 @@ for my $i (reverse (map {$_} @array, 1)) {
$r .= $i;
}
is ($r, '1CBA', 'Reverse for array and value via map with var');
+
+TODO: {
+ $test++;
+ no warnings 'reserved';
+ local $TODO = "RT #2166: foreach spuriously autovivifies";
+ my %h;
+ foreach (@h{a, b}) {}
+ if(keys(%h)) {
+ print "not ";
+ }
+ print "ok $test # TODO $TODO\n";
+}