diff options
Diffstat (limited to 't')
-rw-r--r-- | t/op/state.t | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/t/op/state.t b/t/op/state.t index 260fa8bf38..6da247874e 100644 --- a/t/op/state.t +++ b/t/op/state.t @@ -9,7 +9,7 @@ BEGIN { use strict; use feature "state"; -plan tests => 23; +plan tests => 25; ok( ! defined state $uninit, q(state vars are undef by default) ); @@ -77,3 +77,11 @@ is( $f2->(), 2, 'generator 2 once more' ); ::is( foo(), 20, "increments correctly, twice" ); ::is( $fetchcount, 1, "fetch only called once" ); } + +sub stateless { + # stateless assignment + (state $reinitme) = 42; + ++$reinitme; +} +is( stateless(), 43, 'stateless function, first time' ); +is( stateless(), 43, 'stateless function, second time' ); |