From 5d12fd9aef310de190ad423c111264796c8d81e6 Mon Sep 17 00:00:00 2001 From: moritz Date: Sun, 8 Mar 2009 11:37:52 +0000 Subject: [PATCH] [t/spec] tests for last and next in grep git-svn-id: http://svn.pugscode.org/pugs@25746 c213334d-75ef-0310-aa23-eaa082d1ae64 --- S32-list/grep.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/S32-list/grep.t b/S32-list/grep.t index 7ead7ef123..7296d70924 100644 --- a/S32-list/grep.t +++ b/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'; +} +