Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests to cover RT #113544.
  • Loading branch information
jnthn committed Oct 6, 2015
1 parent 9c5c7a3 commit c597341
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion S05-grammar/signatures.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 2;
plan 10;

# L<S05/Extensible metasyntax (C<< <...> >>)/If the first character is a colon>

Expand All @@ -21,4 +21,42 @@ grammar Grammar::With::Signatures {
ok(Grammar::With::Signatures.parse("barfoo"), 'barfoo matches');
ok(Grammar::With::Signatures.parse("foobar"), 'foobar doesnt match');

# RT #113544
#?rakudo.jvm todo 'Regex compiler needs updating for these arg kinds'
{
grammar AllTheArgKinds {
token TOP {
<.nameds(a => 1, :b(2))>
<.flatpos(|[3,4,5])>
<.flatnamed(|{ c => 6, d => 7 })>
}

token nameds(:$a, :$b) {
{
is $a, 1, 'named arg passed in subrule call with => syntax';
is $b, 2, 'named arg passed in subrule call with colonpair syntax';
}
a
}

token flatpos($a, $b, $c) {
{
is $a, 3, 'flattened positional arg in subrule call (1)';
is $b, 4, 'flattened positional arg in subrule call (2)';
is $c, 5, 'flattened positional arg in subrule call (3)';
}
b
}

token flatnamed(:$c, :$d) {
{
is $c, 6, 'flattening named arg in subrule call (1)';
is $d, 7, 'flattening named arg in subrule call (2)';
}
c
}
}
ok AllTheArgKinds.parse('abc'), 'Grammar with various subrule arg passings parsed';
}

# vim: ft=perl6

0 comments on commit c597341

Please sign in to comment.