diff options
author | Matthew Horsfall <wolfsage@gmail.com> | 2014-01-31 16:52:04 -0500 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-02-03 10:20:09 +1100 |
commit | 872fcb0827582624bb8767608f285e6bf638efd2 (patch) | |
tree | 465b6bb0f214f20d995cb4d3e533432e7ca2842d | |
parent | bfa0ee78b652802412c3cab86bb873ed67ea6550 (diff) | |
download | perl-872fcb0827582624bb8767608f285e6bf638efd2.tar.gz |
Test state vars following padranges [Perl #121134]
-rw-r--r-- | t/op/state.t | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/t/op/state.t b/t/op/state.t index ad51d8be67..b4542e1352 100644 --- a/t/op/state.t +++ b/t/op/state.t @@ -9,7 +9,7 @@ BEGIN { use strict; -plan tests => 132; +plan tests => 136; # Before loading feature.pm, test it with CORE:: ok eval 'CORE::state $x = 1;', 'CORE::state outside of feature.pm scope'; @@ -416,6 +416,36 @@ foreach my $forbidden (<DATA>) { ok(defined $f, 'state init not skipped'); } +# [perl #121134] Make sure padrange doesn't mess with these +{ + sub thing { + my $expect = shift; + my ($x, $y); + state $z; + + is($z, $expect, "State variable is correct"); + + $z = 5; + } + + thing(undef); + thing(5); + + sub thing2 { + my $expect = shift; + my $x; + my $y; + state $z; + + is($z, $expect, "State variable is correct"); + + $z = 6; + } + + thing2(undef); + thing2(6); +} + __DATA__ state ($a) = 1; |