summaryrefslogtreecommitdiff
path: root/t/op/local.t
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2006-03-10 18:47:56 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-03-14 09:55:17 +0000
commit985d6f616086d072aa92ea0e9eb2b6bd7bdcd439 (patch)
tree184003d49a5f9dcb95610afaeb04fe46079eb524 /t/op/local.t
parent1520dd721f057ec970f4990dc841ca873e6c07a4 (diff)
downloadperl-985d6f616086d072aa92ea0e9eb2b6bd7bdcd439.tar.gz
[perl #38710] localised stash slice
From: Hugo van der Sanden (via RT) <perlbug-followup@perl.org> Message-ID: <rt-3.0.11-38710-131000.18.015529928953@perl.org> (new TODO tests) p4raw-id: //depot/perl@27495
Diffstat (limited to 't/op/local.t')
-rwxr-xr-xt/op/local.t30
1 files changed, 29 insertions, 1 deletions
diff --git a/t/op/local.t b/t/op/local.t
index a186a70559..daa36a73b7 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 => 87;
+plan tests => 95;
my $list_assignment_supported = 1;
@@ -342,3 +342,31 @@ is($@, "");
sub f { ok(0 == $[); }
+# sub localisation
+{
+ package Other;
+
+ sub f1 { "f1" }
+ sub f2 { "f2" }
+
+ no warnings "redefine";
+ {
+ local *f1 = sub { "g1" };
+ ::ok(f1() eq "g1", "localised sub via glob");
+ }
+ ::ok(f1() eq "f1", "localised sub restored");
+ {
+ local $Other::{"f1"} = sub { "h1" };
+ ::ok(f1() eq "h1", "localised sub via stash");
+ }
+ ::ok(f1() eq "f1", "localised sub restored");
+ {
+ local @Other::{qw/ f1 f2 /} = (sub { "j1" }, sub { "j2" });
+ local $::TODO = "localisation of stash slice not working";
+ ::ok(f1() eq "j1", "localised sub via stash slice");
+ ::ok(f2() eq "j2", "localised sub via stash slice");
+ undef $::TODO;
+ }
+ ::ok(f1() eq "f1", "localised sub restored");
+ ::ok(f2() eq "f2", "localised sub restored");
+}