2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
10 $TODO = q{Mouse is not yet completed};
18 sub foo { 'Foo::foo' }
19 sub bar { 'Foo::bar' }
20 sub baz { 'Foo::baz' }
25 with 'My::Role' => { -excludes => 'bar' };
28 ok(My::Class->meta->has_method($_), "we have a $_ method") for qw(foo baz);
29 ok(!My::Class->meta->has_method('bar'), '... but we excluded bar');
32 package My::OtherRole;
35 with 'My::Role' => { -excludes => 'foo' };
37 sub foo { 'My::OtherRole::foo' }
38 sub bar { 'My::OtherRole::bar' }
41 ok(My::OtherRole->meta->has_method($_), "we have a $_ method") for qw(foo bar baz);
43 ok(!My::OtherRole->meta->requires_method('foo'), '... and the &foo method is not required');
44 ok(My::OtherRole->meta->requires_method('bar'), '... and the &bar method is required');
50 sub foo { 'Foo::Role::foo' }
55 sub foo { 'Bar::Role::foo' }
60 sub foo { 'Baz::Role::foo' }
62 package My::Foo::Class;
66 with 'Foo::Role' => { -excludes => 'foo' },
67 'Bar::Role' => { -excludes => 'foo' },
69 } '... composed our roles correctly';
71 package My::Foo::Class::Broken;
76 'Bar::Role' => { -excludes => 'foo' },
78 } qr/Due to a method name conflict in roles 'Baz::Role' and 'Foo::Role', the method 'foo' must be implemented or excluded by 'My::Foo::Class::Broken'/,
79 '... composed our roles correctly';
83 my $foo = My::Foo::Class->new;
84 isa_ok($foo, 'My::Foo::Class');
86 is($foo->foo, 'Baz::Role::foo', '... got the right method');
90 package My::Foo::Role;
94 with 'Foo::Role' => { -excludes => 'foo' },
95 'Bar::Role' => { -excludes => 'foo' },
97 } '... composed our roles correctly';
100 ok(My::Foo::Role->meta->has_method('foo'), "we have a foo method");
101 ok(!My::Foo::Role->meta->requires_method('foo'), '... and the &foo method is not required');
104 package My::Foo::Role::Other;
109 'Bar::Role' => { -excludes => 'foo' },
111 } '... composed our roles correctly';
114 ok(!My::Foo::Role::Other->meta->has_method('foo'), "we dont have a foo method");
115 ok(My::Foo::Role::Other->meta->requires_method('foo'), '... and the &foo method is required');