Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added tests for RT #95514.
  • Loading branch information
peschwa committed Jan 31, 2014
1 parent 1ccbe07 commit 2162736
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion S12-methods/delegation.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 5;
plan 7;

class A {
method Str() handles 'uc' {
Expand All @@ -21,3 +21,29 @@ is_approx $a.sqrt, 2, 'delegation to multiple names (1)';
is $a.floor, 4, 'delegation to multiple names (2)';
is $a.base(16), 'FF', 'delegation and arguments';
is A.base(16), 'FF', '... same with type object invocant';

{
role R {
method foo { self.bar(42) };
method bar($x) { $x };
};

class C does R {
method foo { self.R::foo };
};

is C.new.foo, 42, 'role method calls works through role delegation independent of declaration order.';

role Rr {
method bar($x) { $x };
method foo { self.bar(42) };
};

class Cc does Rr {
method foo { self.Rr::foo };
};

is Cc.new.foo, 42, 'role method calls works through role delegation independent of declaration order.';
}

done;

0 comments on commit 2162736

Please sign in to comment.