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