Mouse::Role improved
[gitmo/Mouse.git] / t / 030_roles / failing / 014_more_alias_and_exclude.t
CommitLineData
67199842 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 9;
7use Test::Exception;
8
9
10
11{
12 package Foo;
13 use Mouse::Role;
6cfa1e5e 14
67199842 15 sub foo { 'Foo::foo' }
16 sub bar { 'Foo::bar' }
17 sub baz { 'Foo::baz' }
6cfa1e5e 18 sub gorch { 'Foo::gorch' }
19
67199842 20 package Bar;
21 use Mouse::Role;
22
23 sub foo { 'Bar::foo' }
24 sub bar { 'Bar::bar' }
25 sub baz { 'Bar::baz' }
6cfa1e5e 26 sub gorch { 'Bar::gorch' }
67199842 27
28 package Baz;
29 use Mouse::Role;
6cfa1e5e 30
67199842 31 sub foo { 'Baz::foo' }
32 sub bar { 'Baz::bar' }
33 sub baz { 'Baz::baz' }
6cfa1e5e 34 sub gorch { 'Baz::gorch' }
35
67199842 36 package Gorch;
37 use Mouse::Role;
6cfa1e5e 38
67199842 39 sub foo { 'Gorch::foo' }
40 sub bar { 'Gorch::bar' }
41 sub baz { 'Gorch::baz' }
6cfa1e5e 42 sub gorch { 'Gorch::gorch' }
67199842 43}
44
45{
46 package My::Class;
47 use Mouse;
6cfa1e5e 48
67199842 49 ::lives_ok {
6cfa1e5e 50 with 'Foo' => { -excludes => [qw/bar baz gorch/], -alias => { gorch => 'foo_gorch' } },
51 'Bar' => { -excludes => [qw/foo baz gorch/] },
52 'Baz' => { -excludes => [qw/foo bar gorch/], -alias => { foo => 'baz_foo', bar => 'baz_bar' } },
53 'Gorch' => { -excludes => [qw/foo bar baz/] };
67199842 54 } '... everything works out all right';
55}
56
57my $c = My::Class->new;
58isa_ok($c, 'My::Class');
59
60is($c->foo, 'Foo::foo', '... got the right method');
61is($c->bar, 'Bar::bar', '... got the right method');
62is($c->baz, 'Baz::baz', '... got the right method');
63is($c->gorch, 'Gorch::gorch', '... got the right method');
64
65is($c->foo_gorch, 'Foo::gorch', '... got the right method');
66is($c->baz_foo, 'Baz::foo', '... got the right method');
67is($c->baz_bar, 'Baz::bar', '... got the right method');
68
69
70
71
72