tweaking test names to better VMS support
[gitmo/Moose.git] / t / 030_roles / 026_role_composition_method_mods.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 9;
7 use Test::Exception;
8
9 BEGIN {
10     use_ok('Moose');
11     use_ok('Moose::Meta::Role::Application::RoleSummation');    
12     use_ok('Moose::Meta::Role::Composite');
13 }
14
15 {
16     package Role::Foo;
17     use Moose::Role;
18     
19     before foo => sub { 'Role::Foo::foo' };
20     around foo => sub { 'Role::Foo::foo' };    
21     after  foo => sub { 'Role::Foo::foo' };        
22     
23     package Role::Bar;
24     use Moose::Role;
25
26     before bar => sub { 'Role::Bar::bar' };
27     around bar => sub { 'Role::Bar::bar' };    
28     after  bar => sub { 'Role::Bar::bar' };    
29 }
30
31 # test simple overrides
32 {
33     my $c = Moose::Meta::Role::Composite->new(
34         roles => [
35             Role::Foo->meta,
36             Role::Bar->meta,
37         ]
38     );
39     isa_ok($c, 'Moose::Meta::Role::Composite');
40
41     is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');    
42     
43     lives_ok {
44         Moose::Meta::Role::Application::RoleSummation->new->apply($c);
45     } '... this succeeds as expected';    
46     
47     is_deeply(
48         [ sort $c->get_method_modifier_list('before') ],
49         [ 'bar', 'foo' ],
50         '... got the right list of methods'
51     );
52     
53     is_deeply(
54         [ sort $c->get_method_modifier_list('after') ],
55         [ 'bar', 'foo' ],
56         '... got the right list of methods'
57     );    
58     
59     is_deeply(
60         [ sort $c->get_method_modifier_list('around') ],
61         [ 'bar', 'foo' ],
62         '... got the right list of methods'
63     );    
64 }