6 use Test::More tests => 15;
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 ok(Role::ExcludesFoo->meta->excludes_role('Role::Foo'), '... got the right exclusions');
36 ok(Role::DoesExcludesFoo->meta->excludes_role('Role::Foo'), '... got the right exclusions');
38 # test simple exclusion
40 Moose::Meta::Role::Application::RoleSummation->new->apply(
41 Moose::Meta::Role::Composite->new(
44 Role::ExcludesFoo->meta,
48 } '... this fails as expected';
52 my $c = Moose::Meta::Role::Composite->new(
58 isa_ok($c, 'Moose::Meta::Role::Composite');
60 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
63 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
64 } '... this lives as expected';
67 # test no conflicts w/exclusion
69 my $c = Moose::Meta::Role::Composite->new(
72 Role::ExcludesFoo->meta,
75 isa_ok($c, 'Moose::Meta::Role::Composite');
77 is($c->name, 'Role::Bar|Role::ExcludesFoo', '... got the composite role name');
80 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
81 } '... this lives as expected';
83 is_deeply([$c->get_excluded_roles_list], ['Role::Foo'], '... has excluded roles');
87 # test conflict with an "inherited" exclusion
89 Moose::Meta::Role::Application::RoleSummation->new->apply(
90 Moose::Meta::Role::Composite->new(
93 Role::DoesExcludesFoo->meta,
98 } '... this fails as expected';
100 # test conflict with an "inherited" exclusion of an "inherited" role
102 Moose::Meta::Role::Application::RoleSummation->new->apply(
103 Moose::Meta::Role::Composite->new(
106 Role::DoesExcludesFoo->meta,
110 } '... this fails as expected';