6 use Test::More tests => 14;
11 use_ok('Moose::Role');
16 Check for repeated inheritence causing
17 a method conflict (which is not really
26 sub foo { 'Role::Base::foo' }
28 package Role::Derived1;
33 package Role::Derived2;
38 package My::Test::Class1;
42 with 'Role::Derived1', 'Role::Derived2';
43 } '... roles composed okay (no conflicts)';
46 ok(Role::Base->meta->has_method('foo'), '... have the method foo as expected');
47 ok(Role::Derived1->meta->has_method('foo'), '... have the method foo as expected');
48 ok(Role::Derived2->meta->has_method('foo'), '... have the method foo as expected');
49 ok(My::Test::Class1->meta->has_method('foo'), '... have the method foo as expected');
51 is(My::Test::Class1->foo, 'Role::Base::foo', '... got the right value from method');
55 Check for repeated inheritence causing
56 a attr conflict (which is not really
65 has 'foo' => (is => 'ro', default => 'Role::Base::foo');
67 package Role::Derived7;
72 package Role::Derived8;
77 package My::Test::Class4;
81 with 'Role::Derived7', 'Role::Derived8';
82 } '... roles composed okay (no conflicts)';
85 ok(Role::Base4->meta->has_attribute('foo'), '... have the attribute foo as expected');
86 ok(Role::Derived7->meta->has_attribute('foo'), '... have the attribute foo as expected');
87 ok(Role::Derived8->meta->has_attribute('foo'), '... have the attribute foo as expected');
88 ok(My::Test::Class4->meta->has_attribute('foo'), '... have the attribute foo as expected');
90 is(My::Test::Class4->new->foo, 'Role::Base::foo', '... got the right value from method');