Skip to content

Commit 91543c1

Browse files
committed
Test for role/mixin/grammar/LTM interaction.
1 parent 346be83 commit 91543c1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

t/nqp/66-pararole.t

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plan(4);
1+
plan(6);
22

33
role ParaTest[$a] {
44
method m() { $a }
@@ -26,3 +26,15 @@ $b.HOW.mixin($b, ParaNameTest.HOW.curry(ParaNameTest, "drink", "beer"));
2626
$b.HOW.mixin($b, ParaNameTest.HOW.curry(ParaNameTest, "meat", "beef"));
2727
ok($b.drink eq "beer", "parametric method name handling works (1)");
2828
ok($b.meat eq "beef", "parametric method name handling works (2)");
29+
30+
grammar LolGrammar {
31+
token TOP { <foo> }
32+
proto token foo {*}
33+
token foo:sym<a> { <sym> }
34+
}
35+
role AnotherFoo[$x] {
36+
token foo:sym<more> { $x }
37+
}
38+
ok(LolGrammar.parse('abc') eq 'a', "parametric mixin/grammar/LTM interaction (sanity)");
39+
my $derived := LolGrammar.HOW.mixin(LolGrammar, AnotherFoo.HOW.curry(AnotherFoo, 'ab'));
40+
ok($derived.parse('abc') eq 'ab', "parametric mixin/grammar/LTM interaction");

0 commit comments

Comments
 (0)