Permalink
Browse files

[t/spec] Added test for required whitespace after a built-in statemen…

…t (if,for,while).

git-svn-id: http://svn.pugscode.org/pugs@24843 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
azawawi
azawawi committed Jan 9, 2009
1 parent 61bc5e2 commit abbd86a4d38f5d3542da493631b7eea9a3bde5a2
Showing with 16 additions and 3 deletions.
  1. +4 −1 S04-statements/for.t
  2. +4 −1 S04-statements/if.t
  3. +8 −1 S04-statements/while.t
View
@@ -11,7 +11,7 @@ for statement as possible
=end description
-plan 43;
+plan 44;
## No foreach
# L<S04/The C<for> statement/"no foreach statement any more">
@@ -349,4 +349,7 @@ my @elems = <a b c d e>;
is $output, "1,2,3,4,", "grep and sort work in for";
}
+#L<S04/"keywords require whitespace">
+eval_dies_ok('for(0..5) { }','keyword needs at least one whitespace after it');
+
# vim: ft=perl6
View
@@ -10,7 +10,7 @@ L<S04/"Conditional statements">
=end kwid
-plan 24;
+plan 25;
my $x = 'test';
if ($x eq $x) { pass("if ($x eq $x) {} works"); } else { flunk("if ($x eq $x) {} failed"); }
@@ -151,4 +151,7 @@ is $foo, 1, "die should stop execution immediately.";
is $got, '', 'else -> $c { } binding previous if';
}
+#L<S04/"keywords require whitespace">
+eval_dies_ok('if($x > 1) {}','keyword needs at least one whitespace after it');
+
# vim: ft=perl6
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 8;
+plan 9;
{
my $i = 0;
@@ -62,3 +62,10 @@ plan 8;
}
is $str, '54321', 'while ... -> $x {...} worked (2)';
}
+
+#L<S04/"keywords require whitespace">
+{
+ my $i = 0;
+ eval_dies_ok('while($i < 5) { $i++; }',
+ 'keyword needs at least one whitespace after it');
+}

0 comments on commit abbd86a

Please sign in to comment.