Re: [perl #41071] require stringifies code references in tied @INC
[p5sagit/p5-mst-13.2.git] / t / op / state.t
index 6d09813..92b4dfc 100644 (file)
@@ -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,7 +105,8 @@ is( gen_cashier()->{bal}->(), 42, '$42 in my drawer' );
 # stateless assignment to a state variable
 
 sub stateless {
-    (state $reinitme) = 42;
+    no warnings 'misc';
+    (state $reinitme, my $foo) = (42, 'bar');
     ++$reinitme;
 }
 is( stateless(), 43, 'stateless function, first time' );
@@ -151,7 +152,16 @@ sub statelist {
 my $ls = statelist();
 is($ls, "12/23", 'list assignment to state scalars');
 $ls = statelist();
-{
-    local our $TODO = 'make aassign handle state vars';
-    is($ls, "13/24", 'list assignment to state scalars');
+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();
+is($ls, "3/4", 'list assignment to state scalars');