9 use Moose::Meta::Role::Application::RoleSummation;
10 use Moose::Meta::Role::Composite;
15 has 'foo' => (is => 'rw');
19 has 'bar' => (is => 'rw');
21 package Role::FooConflict;
23 has 'foo' => (is => 'rw');
25 package Role::BarConflict;
27 has 'bar' => (is => 'rw');
29 package Role::AnotherFooConflict;
31 with 'Role::FooConflict';
34 # test simple attributes
36 my $c = Moose::Meta::Role::Composite->new(
42 isa_ok($c, 'Moose::Meta::Role::Composite');
44 is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
47 Moose::Meta::Role::Application::RoleSummation->new->apply($c);
48 }, undef, '... this succeeds as expected' );
51 [ sort $c->get_attribute_list ],
53 '... got the right list of attributes'
57 # test simple conflict
59 Moose::Meta::Role::Application::RoleSummation->new->apply(
60 Moose::Meta::Role::Composite->new(
63 Role::FooConflict->meta,
67 }, undef, '... this fails as expected' );
69 # test complex conflict
71 Moose::Meta::Role::Application::RoleSummation->new->apply(
72 Moose::Meta::Role::Composite->new(
76 Role::FooConflict->meta,
77 Role::BarConflict->meta,
81 }, undef, '... this fails as expected' );
83 # test simple conflict
85 Moose::Meta::Role::Application::RoleSummation->new->apply(
86 Moose::Meta::Role::Composite->new(
89 Role::AnotherFooConflict->meta,
93 }, undef, '... this fails as expected' );