6 use Test::More tests => 22;
11 use_ok('Moose::Meta::Role::Application::RoleSummation');
12 use_ok('Moose::Meta::Role::Composite');
19 sub foo { 'Role::Foo::foo' }
24 sub bar { 'Role::Bar::bar' }
26 package Role::FooConflict;
29 sub foo { 'Role::FooConflict::foo' }
31 package Role::BarConflict;
34 sub bar { 'Role::BarConflict::bar' }
36 package Role::AnotherFooConflict;
38 with 'Role::FooConflict';
40 sub baz { 'Role::AnotherFooConflict::baz' }
43 # test simple attributes
45 my $c = Moose::Meta::Role::Composite->new(
51 isa_ok($c, 'Moose::Meta::Role::Composite');
53 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
56 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
57 } '... this succeeds as expected';
60 [ sort $c->get_method_list ],
62 '... got the right list of methods'
66 # test simple conflict
68 my $c = Moose::Meta::Role::Composite->new(
71 Role::FooConflict->meta,
74 isa_ok($c, 'Moose::Meta::Role::Composite');
76 is($c->name, 'Role::Foo|Role::FooConflict', '... got the composite role name');
79 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
80 } '... this succeeds as expected';
83 [ sort $c->get_method_list ],
85 '... got the right list of methods'
89 [ sort $c->get_required_method_list ],
91 '... got the right list of required methods'
95 # test complex conflict
97 my $c = Moose::Meta::Role::Composite->new(
101 Role::FooConflict->meta,
102 Role::BarConflict->meta,
105 isa_ok($c, 'Moose::Meta::Role::Composite');
107 is($c->name, 'Role::Foo|Role::Bar|Role::FooConflict|Role::BarConflict', '... got the composite role name');
110 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
111 } '... this succeeds as expected';
114 [ sort $c->get_method_list ],
116 '... got the right list of methods'
120 [ sort $c->get_required_method_list ],
122 '... got the right list of required methods'
126 # test simple conflict
128 my $c = Moose::Meta::Role::Composite->new(
131 Role::AnotherFooConflict->meta,
134 isa_ok($c, 'Moose::Meta::Role::Composite');
136 is($c->name, 'Role::Foo|Role::AnotherFooConflict', '... got the composite role name');
139 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
140 } '... this succeeds as expected';
143 [ sort $c->get_method_list ],
145 '... got the right list of methods'
149 [ sort $c->get_required_method_list ],
151 '... got the right list of required methods'