From: gfx Date: Thu, 8 Oct 2009 08:42:17 +0000 (+0900) Subject: Resolve 4 'failing' tests X-Git-Tag: 0.37_04~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6fea087bcf1c984bd8afc7c2d5b4a078569e3b5c;p=gitmo%2FMouse.git Resolve 4 'failing' tests --- diff --git a/t/030_roles/failing/008_role_conflict_edge_cases.t b/t/030_roles/008_role_conflict_edge_cases.t similarity index 96% rename from t/030_roles/failing/008_role_conflict_edge_cases.t rename to t/030_roles/008_role_conflict_edge_cases.t index ad1b908..f22db0e 100644 --- a/t/030_roles/failing/008_role_conflict_edge_cases.t +++ b/t/030_roles/008_role_conflict_edge_cases.t @@ -88,10 +88,15 @@ ok(Role::Base2->meta->has_override_method_modifier('foo'), '... have the method 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'); @@ -141,10 +146,15 @@ ok(Role::Base3->meta->has_around_method_modifiers('foo'), '... have the method f 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'); diff --git a/t/030_roles/failing/013_method_aliasing_in_composition.t b/t/030_roles/013_method_aliasing_in_composition.t similarity index 95% rename from t/030_roles/failing/013_method_aliasing_in_composition.t rename to t/030_roles/013_method_aliasing_in_composition.t index c4e5962..9cb7b9b 100644 --- a/t/030_roles/failing/013_method_aliasing_in_composition.t +++ b/t/030_roles/013_method_aliasing_in_composition.t @@ -58,8 +58,11 @@ ok(My::Class->meta->has_method($_), "we have a $_ method") for qw(foo baz bar ro } 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; @@ -101,12 +104,11 @@ ok(!My::AliasingRole->meta->requires_method('bar'), '... and the &bar method is 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'; } { @@ -135,8 +137,11 @@ ok(!My::Foo::Role->meta->requires_method('foo'), '... and the &foo method is not { 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' }, @@ -145,8 +150,10 @@ ok(!My::Foo::Role->meta->requires_method('foo'), '... and the &foo method is not } 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; diff --git a/t/030_roles/failing/014_more_alias_and_exclude.t b/t/030_roles/014_more_alias_and_exclude.t similarity index 100% rename from t/030_roles/failing/014_more_alias_and_exclude.t rename to t/030_roles/014_more_alias_and_exclude.t diff --git a/t/030_roles/failing/033_role_exclusion_and_alias_bug.t b/t/030_roles/033_role_exclusion_and_alias_bug.t similarity index 98% rename from t/030_roles/failing/033_role_exclusion_and_alias_bug.t rename to t/030_roles/033_role_exclusion_and_alias_bug.t index 673bddd..c47b65c 100644 --- a/t/030_roles/failing/033_role_exclusion_and_alias_bug.t +++ b/t/030_roles/033_role_exclusion_and_alias_bug.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More tests => 17; +use lib 't/lib'; use Test::Mouse; { diff --git a/t/030_roles/failing/012_method_exclusion_in_composition.t b/t/030_roles/failing/012_method_exclusion_in_composition.t index f678d2c..d852b17 100644 --- a/t/030_roles/failing/012_method_exclusion_in_composition.t +++ b/t/030_roles/failing/012_method_exclusion_in_composition.t @@ -39,7 +39,7 @@ ok(My::OtherRole->meta->has_method($_), "we have a $_ method") for qw(foo bar ba 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; diff --git a/t/030_roles/failing/020_role_composite.t b/t/030_roles/failing/020_role_composite.t index 49ba0a3..0f00eb0 100644 --- a/t/030_roles/failing/020_role_composite.t +++ b/t/030_roles/failing/020_role_composite.t @@ -6,7 +6,7 @@ use warnings; 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; { diff --git a/t/030_roles/failing/021_role_composite_exclusion.t b/t/030_roles/failing/021_role_composite_exclusion.t index ba4d3bc..c8b6f6b 100644 --- a/t/030_roles/failing/021_role_composite_exclusion.t +++ b/t/030_roles/failing/021_role_composite_exclusion.t @@ -6,7 +6,7 @@ use warnings; 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; { diff --git a/t/056-role-combine.t b/t/056-role-combine.t new file mode 100644 index 0000000..6ebe4e3 --- /dev/null +++ b/t/056-role-combine.t @@ -0,0 +1,35 @@ +#!perl +use strict; +use warnings; +use Test::More tests => 2; +use Test::Exception; +{ + package RoleA; + use Mouse::Role; + + sub foo { } + sub bar { } +} +{ + package RoleB; + use Mouse::Role; + + sub foo { } + sub bar { } +} +{ + package Class; + use Mouse; + use Test::More; + use Test::Exception; + + throws_ok { + with qw(RoleA RoleB); + } qr/Due to method name conflicts in roles 'RoleA' and 'RoleB', the methods 'bar' and 'foo' must be/; + + lives_ok { + with RoleA => { -excludes => ['foo'] }, + RoleB => { -excludes => ['bar'] }, + ; + }; +}