Permalink
Browse files

[gsoc_spectest] moved one-pass-parsing test into spec. Added tests fo…

…r regex creation syntax. (added 11 tests, fudged for rakudo)

git-svn-id: http://svn.pugscode.org/pugs@21524 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 956af61 commit 0946d1650c7e710ad3d0bc5aa7d5588632b9c350 Auzon committed Jul 25, 2008
Showing with 53 additions and 0 deletions.
  1. +9 −0 S02-whitespace_and_comments/one-pass-parsing.t
  2. +44 −0 S05-metasyntax/regex.t
@@ -0,0 +1,9 @@
+use v6;
+use Test;
+
+plan 1;
+
+# L<S02/"One-pass parsing">
+
+ok(eval('regex foo { <[ } > ]> }; 1'),
+ "can parse non-backslashed curly and right bracket in cclass");
View
@@ -0,0 +1,44 @@
+use v6;
+use Test;
+
+plan 11;
+
+# L<S05/Regexes are now first-class language, not strings>
+
+eval_dies_ok('qr/foo/', 'qr// is gone');
+
+#?rakudo 2 skip 'rx// syntax not implemented'
+isa_ok(rx/oo/, Regex);
+isa_ok(rx (o), Regex);
+eval_dies_ok('rx(o)', 'rx () whitespace if the delims are parens');
+#?rakudo todo 'regex {} does not make a Regex object'
+isa_ok(regex {oo}, Regex);
+
+eval_dies_ok('rx :foo:', 'colons are not allowed as rx delimiters');
+
+#?rakudo todo 'my $var = /foo/ does not make a Regex object'
+{
+ my $var = /foo/;
+ isa_ok($var, Regex, '$var = /foo/ returns a Regex object');
+}
+
+#?rakudo skip 'my $match = m{oo} does not match on $_'
+{
+ $_ = 'foo';
+ my $match = m{oo};
+ is($match, 'oo', 'm{} always matches instead of making a Regex object');
+}
+
+#?rakudo skip 'my $match = m/oo/ parsefail'
+{
+
+ $_ = 'foo';
+ my $match = m/oo/;
+ is($match, 'oo', 'm{} always matches instead of making a Regex object');
+}
+
+# we'll just check that this syntax is valid for now
+{
+ lives_ok({token foo {bar}}, 'token foo {...} is valid');
+ lives_ok({regex baz {qux}}, 'regex foo {...} is valid');
+}

0 comments on commit 0946d16

Please sign in to comment.