add with qw( Role1 Role2 ) support
[gitmo/Mouse.git] / t / 800_shikabased / 007-multi-roles.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 plan skip_all => "Moose way 'with' function test" unless $ENV{MOUSE_DEVEL};
6 plan tests => 3;
7
8 {
9     package Requires;
10     use Mouse::Role;
11     requires 'foo';
12 }
13
14 {
15     package Method;
16     use Mouse::Role;
17
18     sub foo { 'ok' }
19 }
20
21 {
22     package Method2;
23     use Mouse::Role;
24
25     sub bar { 'yep' }
26 }
27
28 {
29     package MyApp;
30     use Mouse;
31     with ('Requires', 'Method');
32     with ('Method2' => { alias => { bar => 'baz' } });
33 }
34
35 my $m = MyApp->new;
36 is $m->foo, 'ok';
37 is $m->bar, 'yep';
38 is $m->baz, 'yep';
39