summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-06 16:55:57 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-06 16:55:57 +0000
commit3d2c6be36ee5077d71cd3403ed02f6b1b3f5f3c2 (patch)
treefa7f03dec977838d7ce9aa2bce4d2daa80150fd2 /t
parent058cbdf29801a8d93ccfce9e13fe10af6f37109c (diff)
downloadperl-3d2c6be36ee5077d71cd3403ed02f6b1b3f5f3c2.tar.gz
The state() implementation is not yet perfect. Check in a new todo test
p4raw-id: //depot/perl@28498
Diffstat (limited to 't')
-rw-r--r--t/op/state.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/op/state.t b/t/op/state.t
index 31347b1a69..becbb3b0a6 100644
--- a/t/op/state.t
+++ b/t/op/state.t
@@ -10,7 +10,7 @@ BEGIN {
use strict;
use feature "state";
-plan tests => 32;
+plan tests => 34;
ok( ! defined state $uninit, q(state vars are undef by default) );
@@ -105,6 +105,7 @@ is( gen_cashier()->{bal}->(), 42, '$42 in my drawer' );
# stateless assignment to a state variable
sub stateless {
+ no warnings 'misc';
(state $reinitme, my $foo) = (42, 'bar');
++$reinitme;
}
@@ -152,3 +153,17 @@ my $ls = statelist();
is($ls, "12/23", 'list assignment to state scalars');
$ls = statelist();
is($ls, "13/24", 'list assignment to state scalars');
+
+sub statelist2 {
+ state($sherry, $bourbon) = (1 .. 2);
+ $sherry++;
+ $bourbon++;
+ "$sherry/$bourbon";
+}
+
+$ls = statelist2();
+is($ls, "2/3", 'list assignment to state scalars');
+$ls = statelist2();
+{ local our $TODO = 'detection of state vars is misplaced in newASSIGNOP';
+is($ls, "3/4", 'list assignment to state scalars');
+}