Additional tests for RT #38207: "Useless localization of constant ($[)
authorSteve Peters <steve@fisharerojo.org>
Fri, 13 Jan 2006 19:31:19 +0000 (19:31 +0000)
committerSteve Peters <steve@fisharerojo.org>
Fri, 13 Jan 2006 19:31:19 +0000 (19:31 +0000)
in getopts.pl".

p4raw-id: //depot/perl@26835

t/op/local.t

index 3ab8288..a186a70 100755 (executable)
@@ -4,7 +4,7 @@ BEGIN {
     chdir 't' if -d 't';
     require './test.pl';
 }
-plan tests => 85;
+plan tests => 87;
 
 my $list_assignment_supported = 1;
 
@@ -329,3 +329,16 @@ like($@, qr/Modification of a read-only value attempted/);
 # The s/// adds 'g' magic to $_, but it should remain non-readonly
 eval { for("a") { for $x (1,2) { local $_="b"; s/(.*)/+$1/ } } };
 is($@, "");
+
+# Special local() behavior for $[
+# (see RT #38207 - Useless localization of constant ($[) in getopts.pl}
+{
+    local $[ = 1;
+    local $TODO = "local() not currently working correctly with \$[";
+    ok(1 == $[);
+    undef $TODO;
+    f();
+}
+
+sub f { ok(0 == $[); }
+