bae8e0e09f81b00d87c5c082bf3e6fed2950cc0a
[gitmo/Mouse.git] / t / 035-apply-roles-to-roles.t
1 use strict;
2 use warnings;
3 use Test::More tests => 5;
4
5 {
6     package Animal;
7     use Mouse::Role;
8     requires 'bark';
9     sub eat { 'delicious' }
10     has food => ( is => 'ro' );
11 }
12
13 {
14     package Dog;
15     use Mouse::Role;
16     with 'Animal';
17 }
18
19 {
20     package Chihuahua;
21     use Mouse;
22     with 'Dog';
23     sub bark { 'bow-wow' }
24 }
25
26 ok !Animal->can('food');
27 ok !Dog->can('food');
28
29 my $c = Chihuahua->new(food => 'bone');
30 is $c->eat(), 'delicious';
31 is $c->food(), 'bone';
32 is $c->bark(), 'bow-wow';
33