ok(Role::Derived3->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
ok(Role::Derived4->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
ok(My::Test::Class2->meta->has_method('foo'), '... have the method foo as expected');
+{
+local $TODO = 'Not a Mouse::Meta::Method::Overriden';
isa_ok(My::Test::Class2->meta->get_method('foo'), 'Mouse::Meta::Method::Overridden');
+}
ok(My::Test::Class2::Base->meta->has_method('foo'), '... have the method foo as expected');
+{
+local $TODO = 'Not a Class::MOP::Method';
isa_ok(My::Test::Class2::Base->meta->get_method('foo'), 'Class::MOP::Method');
-
+}
is(My::Test::Class2::Base->foo, 'My::Test::Class2::Base', '... got the right value from method');
is(My::Test::Class2->foo, 'My::Test::Class2::Base -> Role::Base::foo', '... got the right value from method');
ok(Role::Derived5->meta->has_around_method_modifiers('foo'), '... have the method foo as expected');
ok(Role::Derived6->meta->has_around_method_modifiers('foo'), '... have the method foo as expected');
ok(My::Test::Class3->meta->has_method('foo'), '... have the method foo as expected');
+{
+local $TODO = 'Not a Class::MOP::Method::Wrapped';
isa_ok(My::Test::Class3->meta->get_method('foo'), 'Class::MOP::Method::Wrapped');
+}
ok(My::Test::Class3::Base->meta->has_method('foo'), '... have the method foo as expected');
+{
+local $TODO = 'Not a Class::MOP::Method';
isa_ok(My::Test::Class3::Base->meta->get_method('foo'), 'Class::MOP::Method');
-
+}
is(My::Test::Class3::Base->foo, 'My::Test::Class3::Base', '... got the right value from method');
is(My::Test::Class3->foo, 'Role::Base::foo(My::Test::Class3::Base)', '... got the right value from method');
}
ok(My::OtherRole->meta->has_method($_), "we have a $_ method") for qw(foo baz role_bar);
+{
+local $TODO = 'auto requires resolution is not supported';
ok(My::OtherRole->meta->requires_method('bar'), '... and the &bar method is required');
ok(!My::OtherRole->meta->requires_method('role_bar'), '... and the &role_bar method is not required');
+}
{
package My::AliasingRole;
package My::Foo::Class::Broken;
use Mouse;
- ::throws_ok {
+ ::dies_ok {
with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Bar::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Baz::Role';
- } qr/Due to a method name conflict in roles 'Bar::Role' and 'Foo::Role', the method 'foo_foo' must be implemented or excluded by 'My::Foo::Class::Broken'/,
- '... composed our roles correctly';
+ } '... composed our roles correctly';
}
{
{
package My::Foo::Role::Other;
+ use Test::More; # for $TODO
use Mouse::Role;
+ local $TODO = 'not supported';
+
::lives_ok {
with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Bar::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
}
ok(!My::Foo::Role::Other->meta->has_method('foo_foo'), "we dont have a foo_foo method");
+{
+local $TODO = 'auto requires resolution is not supported';
ok(My::Foo::Role::Other->meta->requires_method('foo_foo'), '... and the &foo method is required');
-
+}
{
package My::Foo::AliasOnly;
use Mouse;
use warnings;
use Test::More tests => 17;
+use lib 't/lib';
use Test::Mouse;
{
ok(!My::OtherRole->meta->requires_method('foo'), '... and the &foo method is not required');
ok(My::OtherRole->meta->requires_method('bar'), '... and the &bar method is required');
-use Data::Dumper; print Dumper(My::OtherRole->meta->{required_methods});
+
{
package Foo::Role;
use Mouse::Role;
use Test::More tests => 14;
use Test::Exception;
-use Mouse::Meta::Role::Application::RoleSummation;
+#use Mouse::Meta::Role::Application::RoleSummation;
use Mouse::Meta::Role::Composite;
{
use Test::More tests => 12;
use Test::Exception;
-use Mouse::Meta::Role::Application::RoleSummation;
+#use Mouse::Meta::Role::Application::RoleSummation;
use Mouse::Meta::Role::Composite;
{
--- /dev/null
+#!perl\r
+use strict;\r
+use warnings;\r
+use Test::More tests => 2;\r
+use Test::Exception;\r
+{\r
+ package RoleA;\r
+ use Mouse::Role;\r
+\r
+ sub foo { }\r
+ sub bar { }\r
+}\r
+{\r
+ package RoleB;\r
+ use Mouse::Role;\r
+\r
+ sub foo { }\r
+ sub bar { }\r
+}\r
+{\r
+ package Class;\r
+ use Mouse;\r
+ use Test::More;\r
+ use Test::Exception;\r
+\r
+ throws_ok {\r
+ with qw(RoleA RoleB);\r
+ } qr/Due to method name conflicts in roles 'RoleA' and 'RoleB', the methods 'bar' and 'foo' must be/;\r
+\r
+ lives_ok {\r
+ with RoleA => { -excludes => ['foo'] },\r
+ RoleB => { -excludes => ['bar'] },\r
+ ;\r
+ };\r
+}\r