Skip to content

Commit

Permalink
[t/spec] tests for last and next in grep
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@25746 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Mar 8, 2009
1 parent 2136dcb commit 5d12fd9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion S32-list/grep.t
Expand Up @@ -9,7 +9,7 @@ built-in grep tests
=end pod

plan 34;
plan 36;

my @list = (1 .. 10);

Expand Down Expand Up @@ -86,3 +86,12 @@ my @list = (1 .. 10);
'mutating $_ in grep works (2)';
}

# grep with last, next etc.

{
is (1..16).grep({last if $_ % 5 == 0; $_ % 2 == 0}).join('|'),
'2|4', 'last works in grep';
is (1..12).grep({next if $_ % 5 == 0; $_ % 2 == 0}).join('|'),
'2|4|6|8|12', 'next works in grep';
}

0 comments on commit 5d12fd9

Please sign in to comment.