6 use Test::More tests => 7;
9 use Mouse::Meta::Role::Application::RoleSummation;
10 use Mouse::Meta::Role::Composite;
16 before foo => sub { 'Role::Foo::foo' };
17 around foo => sub { 'Role::Foo::foo' };
18 after foo => sub { 'Role::Foo::foo' };
19 around baz => sub { [ 'Role::Foo', @{shift->(@_)} ] };
24 before bar => sub { 'Role::Bar::bar' };
25 around bar => sub { 'Role::Bar::bar' };
26 after bar => sub { 'Role::Bar::bar' };
32 around baz => sub { [ 'Role::Baz', @{shift->(@_)} ] };
37 package Class::FooBar;
41 sub foo { 'placeholder' }
42 sub baz { ['Class::FooBar'] }
45 #test modifier call order
49 ['Role::Baz','Role::Foo','Class::FooBar']
53 # test simple overrides
55 my $c = Mouse::Meta::Role::Composite->new(
61 isa_ok($c, 'Mouse::Meta::Role::Composite');
63 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
66 Mouse::Meta::Role::Application::RoleSummation->new->apply($c);
67 } '... this succeeds as expected';
70 [ sort $c->get_method_modifier_list('before') ],
72 '... got the right list of methods'
76 [ sort $c->get_method_modifier_list('after') ],
78 '... got the right list of methods'
82 [ sort $c->get_method_modifier_list('around') ],
83 [ 'bar', 'baz', 'foo' ],
84 '... got the right list of methods'