Commit | Line | Data |
---|---|---|
2774c5e2 | 1 | use strict; |
2 | use warnings; | |
3 | use Test::More; | |
4 | ||
5 | plan skip_all => "Moose way 'with' function test" unless $ENV{MOUSE_DEVEL}; | |
21498b08 | 6 | plan tests => 3; |
2774c5e2 | 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 | { | |
2774c5e2 | 22 | package Method2; |
23 | use Mouse::Role; | |
24 | ||
21498b08 | 25 | sub bar { 'yep' } |
2774c5e2 | 26 | } |
27 | ||
2774c5e2 | 28 | { |
29 | package MyApp; | |
30 | use Mouse; | |
21498b08 | 31 | with ('Requires', 'Method'); |
32 | with ('Method2' => { alias => { bar => 'baz' } }); | |
2774c5e2 | 33 | } |
34 | ||
35 | my $m = MyApp->new; | |
36 | is $m->foo, 'ok'; | |
37 | is $m->bar, 'yep'; | |
21498b08 | 38 | is $m->baz, 'yep'; |
2774c5e2 | 39 |