Move is_valid_class_name into XS
[gitmo/Mouse.git] / t / 001_mouse / 036-with-method-alias.t
1 use strict;
2 use warnings;
3 use Test::More tests => 6;
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         -excludes => [qw(eat)],
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', {
31         -alias    => { eat => 'drink' },
32     };
33 }
34
35 ok(Dog->can('eat'));
36 ok(Dog->can('drink'));
37
38 my $d = Dog->new();
39 is($d->drink(), 'delicious');
40 is($d->eat(),   'delicious');
41
42 my $t = Tama->new;
43 is $t->drink(), 'delicious';
44 is $t->eat(),    'good!';
45