Skip to content

Commit 045172e

Browse files
committed
Tests for ::(...) in method names.
1 parent 3245496 commit 045172e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

t/nqp/66-pararole.t

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

33
role ParaTest[$a] {
44
method m() { $a }
@@ -14,3 +14,18 @@ $a2.HOW.mixin($a2, ParaTest.HOW.curry(ParaTest, "bar"));
1414
ok($a1.m eq "foo", "mixin of parametric role with first arg");
1515
ok($a2.m eq "bar", "mixin of parametric role with second arg");
1616

17+
role ParaNameTest[$n, $rv] {
18+
method ::($n)() { $rv }
19+
}
20+
21+
class B {
22+
}
23+
24+
my $b := B.new();
25+
$b.HOW.mixin($b, ParaNameTest.HOW.curry(ParaNameTest, "drink", "beer"));
26+
$b.HOW.mixin($b, ParaNameTest.HOW.curry(ParaNameTest, "meat", "beef"));
27+
for $b.HOW.method_table($b) {
28+
say($_.key);
29+
}
30+
ok($b.drink eq "beer", "parametric method name handling works (1)");
31+
ok($b.meat eq "beef", "parametric method name handling works (2)");

0 commit comments

Comments
 (0)