6 use Test::More tests => 19;
11 use_ok('Moose::Meta::Role::Application::RoleSummation');
12 use_ok('Moose::Meta::Role::Composite');
24 package Role::ProvidesFoo;
26 sub foo { 'Role::ProvidesFoo::foo' }
28 package Role::ProvidesBar;
30 sub bar { 'Role::ProvidesBar::bar' }
33 # test simple requirement
35 my $c = Moose::Meta::Role::Composite->new(
41 isa_ok($c, 'Moose::Meta::Role::Composite');
43 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
46 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
47 } '... this succeeds as expected';
50 [ sort $c->get_required_method_list ],
52 '... got the right list of required methods'
56 # test requirement satisfied
58 my $c = Moose::Meta::Role::Composite->new(
61 Role::ProvidesFoo->meta,
64 isa_ok($c, 'Moose::Meta::Role::Composite');
66 is($c->name, 'Role::Foo|Role::ProvidesFoo', '... got the composite role name');
69 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
70 } '... this succeeds as expected';
73 [ sort $c->get_required_method_list ],
75 '... got the right list of required methods'
79 # test requirement satisfied
81 my $c = Moose::Meta::Role::Composite->new(
84 Role::ProvidesFoo->meta,
88 isa_ok($c, 'Moose::Meta::Role::Composite');
90 is($c->name, 'Role::Foo|Role::ProvidesFoo|Role::Bar', '... got the composite role name');
93 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
94 } '... this succeeds as expected';
97 [ sort $c->get_required_method_list ],
99 '... got the right list of required methods'
103 # test requirement satisfied
105 my $c = Moose::Meta::Role::Composite->new(
108 Role::ProvidesFoo->meta,
109 Role::ProvidesBar->meta,
113 isa_ok($c, 'Moose::Meta::Role::Composite');
115 is($c->name, 'Role::Foo|Role::ProvidesFoo|Role::ProvidesBar|Role::Bar', '... got the composite role name');
118 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
119 } '... this succeeds as expected';
122 [ sort $c->get_required_method_list ],
124 '... got the right list of required methods'