diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2002-05-06 18:17:00 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-05-06 15:29:58 +0000 |
commit | 159ad9158da627b6008687c4cd6aaaa0f0c7d16f (patch) | |
tree | 3098413e628a2bdd7ee1a8961849114bcf48fb71 /t | |
parent | 536cc2c14e13822cdd93e5b1aef6723e848db3fd (diff) | |
download | perl-159ad9158da627b6008687c4cd6aaaa0f0c7d16f.tar.gz |
Re: [proposed PATCH] correctly unlocalise exists on tied/%ENV
Message-ID: <20020506171700.A256@fdgroup.com>
p4raw-id: //depot/perl@16434
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 d23b200022..6da03912e9 100755 --- a/t/op/local.t +++ b/t/op/local.t @@ -1,6 +1,6 @@ #!./perl -print "1..71\n"; +print "1..75\n"; sub foo { local($a, $b) = @_; @@ -142,6 +142,8 @@ tie %h, 'TH'; { local($h{'a'}) = 'foo'; local($h{'b'}) = $h{'b'}; + local($h{'y'}); + local($h{'z'}) = 33; print +($h{'a'} eq 'foo') ? "" : "not ", "ok 42\n"; print +($h{'b'} == 2) ? "" : "not ", "ok 43\n"; local($h{'c'}); @@ -183,6 +185,8 @@ $ENV{_X_} = 'a'; $ENV{_Y_} = 'b'; $ENV{_Z_} = 'c'; { + local($ENV{_A_}); + local($ENV{_B_}) = 'foo'; local($ENV{_X_}) = 'foo'; local($ENV{_Y_}) = $ENV{_Y_}; print +($ENV{_X_} eq 'foo') ? "" : "not ", "ok 54\n"; @@ -244,3 +248,12 @@ while (/(o.+?),/gc) { print "not " if exists $x{c}; print "ok 71\n"; } + +# these tests should be physically located after tests 46 and 58, +# but are here instead to avoid renumbering everything. + +# local() should preserve the existenceness of tied hashes and %ENV +print "not " if exists $h{'y'}; print "ok 72\n"; +print "not " if exists $h{'z'}; print "ok 73\n"; +print "not " if exists $ENV{_A_}; print "ok 74\n"; +print "not " if exists $ENV{_B_}; print "ok 75\n"; |