Move t/*/t into t/001_mouse
[gitmo/Mouse.git] / t / 001_mouse / 036-with-method-alias.t
CommitLineData
4aaa2ed6 1use strict;
2use warnings;
6cfa1e5e 3use Test::More tests => 6;
4aaa2ed6 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', {
6cfa1e5e 15 -alias => { eat => 'drink' },
16 -excludes => [qw(eat)],
4aaa2ed6 17 };
18 sub eat { 'good!' }
19}
20
21{
22 package Tama;
23 use Mouse;
24 with 'Cat';
25}
26
27{
28 package Dog;
29 use Mouse;
30 with 'Animal', {
6cfa1e5e 31 -alias => { eat => 'drink' },
4aaa2ed6 32 };
33}
34
21498b08 35ok(Dog->can('eat'));
4aaa2ed6 36ok(Dog->can('drink'));
37
38my $d = Dog->new();
39is($d->drink(), 'delicious');
6cfa1e5e 40is($d->eat(), 'delicious');
4aaa2ed6 41
42my $t = Tama->new;
43is $t->drink(), 'delicious';
44is $t->eat(), 'good!';
45