Commit | Line | Data |
4aaa2ed6 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More tests => 5; |
4 | |
5 | { |
6 | package Animal; |
7 | use Mouse::Role; |
8 | sub eat { 'delicious' } |
9 | } |
10 | |
11 | { |
12 | package Cat; |
13 | use Mouse::Role; |
14 | with 'Animal', { |
15 | alias => { eat => 'drink' }, |
16 | }; |
17 | sub eat { 'good!' } |
18 | } |
19 | |
20 | { |
21 | package Tama; |
22 | use Mouse; |
23 | with 'Cat'; |
24 | } |
25 | |
26 | { |
27 | package Dog; |
28 | use Mouse; |
29 | with 'Animal', { |
30 | alias => { eat => 'drink' } |
31 | }; |
32 | } |
33 | |
34 | ok(!Dog->can('eat')); |
35 | ok(Dog->can('drink')); |
36 | |
37 | my $d = Dog->new(); |
38 | is($d->drink(), 'delicious'); |
39 | |
40 | my $t = Tama->new; |
41 | is $t->drink(), 'delicious'; |
42 | is $t->eat(), 'good!'; |
43 | |