diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-01-13 19:31:19 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-01-13 19:31:19 +0000 |
commit | 4cb09e0a8a1169d65b9839bce3178d5bddd79127 (patch) | |
tree | 924aed394e2e6a558fe0fcd51155a1f1712f97b5 /t | |
parent | ba1af1f8a2de73984e3ae0449178c96c696cf2b7 (diff) | |
download | perl-4cb09e0a8a1169d65b9839bce3178d5bddd79127.tar.gz |
Additional tests for RT #38207: "Useless localization of constant ($[)
in getopts.pl".
p4raw-id: //depot/perl@26835
Diffstat (limited to 't')
-rwxr-xr-x | t/op/local.t | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/t/op/local.t b/t/op/local.t index 3ab828838b..a186a70559 100755 --- a/t/op/local.t +++ b/t/op/local.t @@ -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 == $[); } + |