Commit | Line | Data |
28412c0b |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
a28e50e4 |
6 | use Test::More; |
b10dde3a |
7 | use Test::Fatal; |
28412c0b |
8 | |
7ff56534 |
9 | |
28412c0b |
10 | { |
11 | package Foo; |
12 | use Moose::Role; |
d03bd989 |
13 | |
28412c0b |
14 | sub foo { 'Foo::foo' } |
15 | sub bar { 'Foo::bar' } |
16 | sub baz { 'Foo::baz' } |
d03bd989 |
17 | sub gorch { 'Foo::gorch' } |
18 | |
28412c0b |
19 | package Bar; |
20 | use Moose::Role; |
21 | |
22 | sub foo { 'Bar::foo' } |
23 | sub bar { 'Bar::bar' } |
24 | sub baz { 'Bar::baz' } |
d03bd989 |
25 | sub gorch { 'Bar::gorch' } |
28412c0b |
26 | |
27 | package Baz; |
28 | use Moose::Role; |
d03bd989 |
29 | |
28412c0b |
30 | sub foo { 'Baz::foo' } |
31 | sub bar { 'Baz::bar' } |
32 | sub baz { 'Baz::baz' } |
d03bd989 |
33 | sub gorch { 'Baz::gorch' } |
34 | |
28412c0b |
35 | package Gorch; |
36 | use Moose::Role; |
d03bd989 |
37 | |
28412c0b |
38 | sub foo { 'Gorch::foo' } |
39 | sub bar { 'Gorch::bar' } |
40 | sub baz { 'Gorch::baz' } |
d03bd989 |
41 | sub gorch { 'Gorch::gorch' } |
28412c0b |
42 | } |
43 | |
44 | { |
45 | package My::Class; |
46 | use Moose; |
d03bd989 |
47 | |
b10dde3a |
48 | ::is( ::exception { |
c8b8d92f |
49 | with 'Foo' => { -excludes => [qw/bar baz gorch/], -alias => { gorch => 'foo_gorch' } }, |
50 | 'Bar' => { -excludes => [qw/foo baz gorch/] }, |
51 | 'Baz' => { -excludes => [qw/foo bar gorch/], -alias => { foo => 'baz_foo', bar => 'baz_bar' } }, |
52 | 'Gorch' => { -excludes => [qw/foo bar baz/] }; |
b10dde3a |
53 | }, undef, '... everything works out all right' ); |
28412c0b |
54 | } |
55 | |
56 | my $c = My::Class->new; |
57 | isa_ok($c, 'My::Class'); |
58 | |
59 | is($c->foo, 'Foo::foo', '... got the right method'); |
60 | is($c->bar, 'Bar::bar', '... got the right method'); |
61 | is($c->baz, 'Baz::baz', '... got the right method'); |
62 | is($c->gorch, 'Gorch::gorch', '... got the right method'); |
63 | |
64 | is($c->foo_gorch, 'Foo::gorch', '... got the right method'); |
65 | is($c->baz_foo, 'Baz::foo', '... got the right method'); |
66 | is($c->baz_bar, 'Baz::bar', '... got the right method'); |
67 | |
a28e50e4 |
68 | done_testing; |