Skip to content

Commit 2162736

Browse files
committed
Added tests for RT #95514.
1 parent 1ccbe07 commit 2162736

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

S12-methods/delegation.t

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use v6;
22
use Test;
3-
plan 5;
3+
plan 7;
44

55
class A {
66
method Str() handles 'uc' {
@@ -21,3 +21,29 @@ is_approx $a.sqrt, 2, 'delegation to multiple names (1)';
2121
is $a.floor, 4, 'delegation to multiple names (2)';
2222
is $a.base(16), 'FF', 'delegation and arguments';
2323
is A.base(16), 'FF', '... same with type object invocant';
24+
25+
{
26+
role R {
27+
method foo { self.bar(42) };
28+
method bar($x) { $x };
29+
};
30+
31+
class C does R {
32+
method foo { self.R::foo };
33+
};
34+
35+
is C.new.foo, 42, 'role method calls works through role delegation independent of declaration order.';
36+
37+
role Rr {
38+
method bar($x) { $x };
39+
method foo { self.bar(42) };
40+
};
41+
42+
class Cc does Rr {
43+
method foo { self.Rr::foo };
44+
};
45+
46+
is Cc.new.foo, 42, 'role method calls works through role delegation independent of declaration order.';
47+
}
48+
49+
done;

0 commit comments

Comments
 (0)