summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-22 08:08:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-22 08:08:08 +0000
commit94f23f413fc20beae3970bde041120ceeceae8e4 (patch)
tree266d12bedd72b22ae29e522df5a05edf2d4b6814 /t
parent8cd2b3b0459aa552389179eb3ecd4bc82ce1627b (diff)
downloadperl-94f23f413fc20beae3970bde041120ceeceae8e4.tar.gz
fix deeply nested closures that have no references to lexical in
intervening subs p4raw-id: //depot/perl@4834
Diffstat (limited to 't')
-rwxr-xr-xt/op/closure.t18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/op/closure.t b/t/op/closure.t
index 2284be6df1..52d2272b80 100755
--- a/t/op/closure.t
+++ b/t/op/closure.t
@@ -12,7 +12,7 @@ BEGIN {
use Config;
-print "1..169\n";
+print "1..170\n";
my $test = 1;
sub test (&) {
@@ -157,6 +157,22 @@ test {
&{$foo[4]}(4)
};
+for my $n (0..4) {
+ $foo[$n] = sub {
+ # no intervening reference to $n here
+ sub { $n == $_[0] }
+ };
+}
+
+test {
+ $foo[0]->()->(0) and
+ $foo[1]->()->(1) and
+ $foo[2]->()->(2) and
+ $foo[3]->()->(3) and
+ $foo[4]->()->(4)
+};
+
+
# Additional tests by Tom Phoenix <rootbeer@teleport.com>.
{