Permalink
Browse files

[gsoc_spectest] minimal whitespace test. (added 8 tests)

git-svn-id: http://svn.pugscode.org/pugs@21102 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
Auzon Auzon
Auzon authored and Auzon committed Jun 28, 2008
1 parent a0f883c commit cc8fc7816a92cf18d8139d58b9de401465f41081
Showing with 25 additions and 0 deletions.
  1. +25 −0 S02-whitespace_and_comments/minimal-whitespace.t
@@ -0,0 +1,25 @@
+use v6;
+
+use Test;
+
+plan 8;
+
+# L<S03/Minimal whitespace DWIMmery/Whitespace is no longer allowed before>
+
+my @arr = <1 2 3 4 5>;
+eval_dies_ok('@arr [0]', 'array with space before opening brackets does not work');
+
+my %hash = {a => 1, b => 2};
+eval_dies_ok('%hash <a>', 'hash with space before opening brackets does not work (1)');
+eval_dies_ok('%hash {"a"}', 'hash with space before opening braces does not work (2)');
+
+sub code (Int $a) {2 * $a}
+eval_dies_ok('code (5)', 'sub call with space before opening parens does not work');
+
+class Thing {method whatever (Int $a) {3 * $a}}
+eval_dies_ok('Thing .new', 'whitespace is not allowed before . after class name');
+eval_dies_ok('Thing. new', 'whitespace is not allowed after . after class name');
+
+my $o = Thing.new;
+eval_dies_ok('$o .whatever(5)', 'whitespace is not allowed before . before method');
+eval_dies_ok('$o. whatever(5)', 'whitespace is not allowed after . before method');

0 comments on commit cc8fc78

Please sign in to comment.