6 use Test::More no_plan => 1;
11 use_ok('Moose::Meta::Role::Application::RoleSummation');
12 use_ok('Moose::Meta::Role::Composite');
22 package Role::ExcludesFoo;
26 package Role::DoesExcludesFoo;
28 with 'Role::ExcludesFoo';
30 package Role::DoesFoo;
35 # test simple exclusion
37 Moose::Meta::Role::Application::RoleSummation->new->apply(
38 Moose::Meta::Role::Composite->new(
41 Role::ExcludesFoo->meta,
45 } '... this fails as expected';
49 my $c = Moose::Meta::Role::Composite->new(
55 isa_ok($c, 'Moose::Meta::Role::Composite');
57 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
60 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
61 } '... this lives as expected';
64 # test no conflicts w/exclusion
66 my $c = Moose::Meta::Role::Composite->new(
69 Role::ExcludesFoo->meta,
72 isa_ok($c, 'Moose::Meta::Role::Composite');
74 is($c->name, 'Role::Bar|Role::ExcludesFoo', '... got the composite role name');
77 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
78 } '... this lives as expected';
80 is_deeply([$c->get_excluded_roles_list], ['Role::Foo'], '... has excluded roles');
84 # test conflict with an "inherited" exclusion
86 Moose::Meta::Role::Application::RoleSummation->new->apply(
87 Moose::Meta::Role::Composite->new(
90 Role::DoesExcludesFoo->meta,
95 } '... this fails as expected';
97 # test conflict with an "inherited" exclusion of an "inherited" role
99 Moose::Meta::Role::Application::RoleSummation->new->apply(
100 Moose::Meta::Role::Composite->new(
103 Role::DoesExcludesFoo->meta,
107 } '... this fails as expected';