Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added a test for a fail in current rakudos : for @A <-> $_ { $_++ }
Made the preceding tests independant
  • Loading branch information
cognominal committed May 31, 2014
1 parent f7db8cd commit 6228b9f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions S04-statements/for.t
Expand Up @@ -5,7 +5,7 @@ use MONKEY_TYPING;

use Test;

plan 79;
plan 80;

=begin description
Expand Down Expand Up @@ -166,15 +166,28 @@ my @elems = <a b c d e>;
# "for @a -> $var" is ro by default.
#?pugs skip 'parsefail'
{
my @a = <1 2 3 4>;


eval_dies_ok('for @a -> $elem {$elem = 5}', '-> $var is ro by default');

for @a <-> $elem {$elem++;}
is(@a, <2 3 4 5>, '<-> $var is rw');
{
my @a = <1 2 3 4>;
for @a <-> $elem {$elem++;}
is(@a, <2 3 4 5>, '<-> $var is rw');
}

{
my @a = <1 2 3 4>;
for @a <-> $first, $second {$first++; $second++}
is(@a, <2 3 4 5>, '<-> $var, $var2 works');
}

{
my @a = <1 2 3 4>;
for @a <-> $_ {$_++;}
is(@a, <2 3 4 5>, '<-> $_ is rw');
}

for @a <-> $first, $second {$first++; $second++}
is(@a, <3 4 5 6>, '<-> $var, $var2 works');
}

# for with "is rw"
Expand Down

0 comments on commit 6228b9f

Please sign in to comment.