Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec] tests for last and next in grep

git-svn-id: http://svn.pugscode.org/pugs@25746 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 5d12fd9aef310de190ad423c111264796c8d81e6 1 parent 2136dcb
moritz authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 S32-list/grep.t
View
11 S32-list/grep.t
@@ -9,7 +9,7 @@ built-in grep tests
=end pod
-plan 34;
+plan 36;
my @list = (1 .. 10);
@@ -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';
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.