Skip to content

Commit

Permalink
Add test (fudged 'skip') for RT #115614
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Oct 27, 2014
1 parent 6396528 commit ff58ad1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions S04-declarations/state.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 40;
plan 41;

# L<S04/The Relationship of Blocks and Declarations/There is a new state declarator that introduces>

Expand Down Expand Up @@ -194,9 +194,9 @@ plan 40;
{
my $seensize;
my sub fib (Int $n) {
state @seen = 0,1,1;
$seensize = +@seen;
@seen[$n] //= fib($n-1) + fib($n-2);
state @seen = 0,1,1;
$seensize = +@seen;
@seen[$n] //= fib($n-1) + fib($n-2);
}
is fib(10), 55, "fib 10 works";
is $seensize, 10, "list assignment state in fib memoizes";
Expand All @@ -207,9 +207,9 @@ plan 40;
{
my $seensize;
my sub fib (Int $n) {
state $seen = [0,1,1];
$seensize = +@$seen;
$seen[$n] //= fib($n-1) + fib($n-2);
state $seen = [0,1,1];
$seensize = +@$seen;
$seen[$n] //= fib($n-1) + fib($n-2);
}
is fib(10), 55, "fib 2 works";
is $seensize, 10, "[list] assignment state in fib memoizes";
Expand All @@ -221,7 +221,7 @@ plan 40;
# now we're just being plain evil:
subset A of Int where { $_ < state $x++ };
my A $y = -4;
# the compiler could have done some checks somehwere, so
# the compiler could have done some checks somehwere, so
# pick a reasonably high number
dies_ok { $y = 900000 }, 'growing subset types rejects too high values';
lives_ok { $y = 1 }, 'the state variable in subset types works (1)';
Expand All @@ -237,6 +237,12 @@ sub bughunt1 { (state $svar) } #OK not used
'a state variable in parens works with a state variable with //= init';
}

# RT #115614
#?rakudo skip 'RT #115614'
{
lives_ok { state $i++ }, 'can parse "state $i++"';
}

#?rakudo skip 'parse error'
#?DOES 1
{
Expand Down

0 comments on commit ff58ad1

Please sign in to comment.