Permalink
Browse files

[t/spec] Add some tests for doubled gathers.

git-svn-id: http://svn.pugscode.org/pugs@31779 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 90a787d commit 09e8944c16d133d3af6debbe56db7d786d5b3385 colomon committed Jul 21, 2010
Showing with 19 additions and 1 deletion.
  1. +2 −0 S03-operators/series.t
  2. +12 −1 S04-statements/gather.t
  3. +5 −0 S32-list/grep.t
View
@@ -158,6 +158,8 @@ lives_ok { (1 ... 5).perl }, 'Can take .perl of series';
is eval((1 ... 5).perl).join(','), '1,2,3,4,5',
'eval($series.perl) reproduces result list';
+is ~((1 ... *) Z~ ('a' ... 'z')).munch(5), "1a 2b 3c 4d 5e", "Zipping two series in parallel";
+
done_testing;
# vim: ft=perl6
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 16;
+plan 17;
# L<S04/The C<gather> statement prefix/>
@@ -143,5 +143,16 @@ plan 16;
'take with multiple arguments .flat tens out';
}
+{
+ my sub grep-div(@a, $n) {
+ gather for @a {
+ take $_ if $_ %% $n;
+ }
+ }
+
+ my @evens := grep-div((1...*), 2);
+ is ~grep-div(@evens, 3).munch(16), ~grep-div((1...100), 6), "Nested identical gathers";
+}
+
# vim: ft=perl6
View
@@ -136,6 +136,11 @@ my @list = (1 .. 10);
nok <0 1 2>.grep(3), 'Empty return value from grep is false';
}
+# chained greps
+{
+ is ~(1...100).grep(* %% 2).grep(* %% 3), ~(6, 12 ... 100), "chained greps work";
+}
+
done_testing;
# vim: ft=perl6

0 comments on commit 09e8944

Please sign in to comment.