Permalink
Browse files

more for related test

git-svn-id: http://svn.pugscode.org/pugs@25948 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent e681f59 commit 628aa1e3b8bd3e2f2a7e5e5cd37be78d10f3052c szabgab committed Mar 20, 2009
Showing with 19 additions and 1 deletion.
  1. +19 −1 S04-statements/for.t
View
@@ -11,7 +11,7 @@ for statement as possible
=end description
-plan 47;
+plan 49;
## No foreach
# L<S04/The C<for> statement/"no foreach statement any more">
@@ -369,6 +369,15 @@ eval_dies_ok('for(0..5) { }','keyword needs at least one whitespace after it');
#diag ">$str<";
}
+#?rakudo skip 'optional variable in for loop'
+{
+ my $str = '';
+ for 1..5 -> $x, $y? {
+ $str ~= " " ~ $x*$y;
+ }
+ is $str, " 2 12 0";
+}
+
{
my @a = <1 2 3>;
my @b = <4 5 6>;
@@ -379,6 +388,15 @@ eval_dies_ok('for(0..5) { }','keyword needs at least one whitespace after it');
is $res, " 4 10 18", "Z -ed for loop";
}
+{
+ my @a = <1 2 3>;
+ my $str = '';
+
+ for @a Z @a Z @a Z @a Z @a -> $q, $w, $e, $r, $t {
+ $str ~= " " ~ $q*$w*$e*$r*$t;
+ }
+ is $str, " 1 {2**5} {3**5}", "Z-ed for loop with 5 arrays";
+}

0 comments on commit 628aa1e

Please sign in to comment.