9 use Moose::Meta::Role::Application::RoleSummation;
10 use Moose::Meta::Role::Composite;
16 sub foo { 'Role::Foo::foo' }
21 sub bar { 'Role::Bar::bar' }
23 package Role::FooConflict;
26 sub foo { 'Role::FooConflict::foo' }
28 package Role::BarConflict;
31 sub bar { 'Role::BarConflict::bar' }
33 package Role::AnotherFooConflict;
35 with 'Role::FooConflict';
37 sub baz { 'Role::AnotherFooConflict::baz' }
40 # test simple attributes
42 my $c = Moose::Meta::Role::Composite->new(
48 isa_ok($c, 'Moose::Meta::Role::Composite');
50 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
53 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
54 }, undef, '... this succeeds as expected' );
57 [ sort $c->get_method_list ],
59 '... got the right list of methods'
63 # test simple conflict
65 my $c = Moose::Meta::Role::Composite->new(
68 Role::FooConflict->meta,
71 isa_ok($c, 'Moose::Meta::Role::Composite');
73 is($c->name, 'Role::Foo|Role::FooConflict', '... got the composite role name');
76 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
77 }, undef, '... this succeeds as expected' );
80 [ sort $c->get_method_list ],
82 '... got the right list of methods'
86 [ sort $c->get_required_method_list ],
88 '... got the right list of required methods'
92 # test complex conflict
94 my $c = Moose::Meta::Role::Composite->new(
98 Role::FooConflict->meta,
99 Role::BarConflict->meta,
102 isa_ok($c, 'Moose::Meta::Role::Composite');
104 is($c->name, 'Role::Foo|Role::Bar|Role::FooConflict|Role::BarConflict', '... got the composite role name');
107 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
108 }, undef, '... this succeeds as expected' );
111 [ sort $c->get_method_list ],
113 '... got the right list of methods'
117 [ sort $c->get_required_method_list ],
119 '... got the right list of required methods'
123 # test simple conflict
125 my $c = Moose::Meta::Role::Composite->new(
128 Role::AnotherFooConflict->meta,
131 isa_ok($c, 'Moose::Meta::Role::Composite');
133 is($c->name, 'Role::Foo|Role::AnotherFooConflict', '... got the composite role name');
136 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
137 }, undef, '... this succeeds as expected' );
140 [ sort $c->get_method_list ],
142 '... got the right list of methods'
146 [ sort $c->get_required_method_list ],
148 '... got the right list of required methods'