diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-12 14:33:01 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-12 14:33:01 +0000 |
commit | fda9478484acad719a798cc07d7a2ec14093628d (patch) | |
tree | 1aacae21afbe3bf79b06ddf6eefca8ff2dfb409c /t/op/state.t | |
parent | a2fa79ff09c6e833b390c6a5d5fb10ed23b1cac1 (diff) | |
download | perl-fda9478484acad719a798cc07d7a2ec14093628d.tar.gz |
Like fake scalars, state variables shouldn't get new pad entries
at each recursion, in order to be truly stateful. (bug #41789)
p4raw-id: //depot/perl@30548
Diffstat (limited to 't/op/state.t')
-rw-r--r-- | t/op/state.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/state.t b/t/op/state.t index 92b4dfc02f..9f618b0486 100644 --- a/t/op/state.t +++ b/t/op/state.t @@ -10,7 +10,7 @@ BEGIN { use strict; use feature "state"; -plan tests => 34; +plan tests => 37; ok( ! defined state $uninit, q(state vars are undef by default) ); @@ -165,3 +165,13 @@ $ls = statelist2(); is($ls, "2/3", 'list assignment to state scalars'); $ls = statelist2(); is($ls, "3/4", 'list assignment to state scalars'); + +# Recursion + +sub noseworth { + my $level = shift; + state $recursed_state = 123; + is($recursed_state, 123, "state kept through recursion ($level)"); + noseworth($level - 1) if $level; +} +noseworth(2); |