Skip to content

Commit

Permalink
Added list comprehension test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Jul 16, 2014
1 parent 6afc4ee commit 2f5ad58
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion S04-statements/for.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use MONKEY_TYPING;

use Test;

plan 80;
plan 81;

=begin description
Expand Down Expand Up @@ -453,6 +453,12 @@ eval_dies_ok('for(0..5) { }','keyword needs at least one whitespace after it');
is $c, 6, 'infinte for loop ends in time using last';
}

#L<S04/Loop statements/"list comprehensions">
{
my @odd-squares = ($_ * $_ if $_ % 2 for 0..10);
is @odd-squares.join(' '), '1 9 25 49 81', 'list comprehension';
}

# RT #62478
{
try { EVAL('for (my $ii = 1; $ii <= 3; $ii++) { say $ii; }') };
Expand Down

0 comments on commit 2f5ad58

Please sign in to comment.