X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F030_roles%2F005_role_conflict_detection.t;h=d33b1c035ae54c04d4e08e29eab32b1619af4e95;hb=a28e50e44945358d15eb19e4688573741a319fe0;hp=800bdda9e01dc8172438730b256f44ba92466d31;hpb=d03bd989b97597428b460d7f9a021e2931893fa0;p=gitmo%2FMoose.git diff --git a/t/030_roles/005_role_conflict_detection.t b/t/030_roles/005_role_conflict_detection.t index 800bdda..d33b1c0 100644 --- a/t/030_roles/005_role_conflict_detection.t +++ b/t/030_roles/005_role_conflict_detection.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 87; # it's really 124 with kolibrie's tests; +use Test::More; use Test::Exception; =pod @@ -100,7 +100,7 @@ Role method conflicts ::throws_ok { with 'Role::Bling', 'Role::Bling::Bling'; - } qr/requires the method \'bling\' to be implemented/, '... role methods conflicted and method was required'; + } qr/Due to a method name conflict in roles 'Role::Bling' and 'Role::Bling::Bling', the method 'bling' must be implemented or excluded by 'My::Test3'/, '... role methods conflict and method was required'; package My::Test4; use Moose; @@ -190,7 +190,7 @@ Role attribute conflicts ::throws_ok { with 'Role::Boo', 'Role::Boo::Hoo'; } qr/We have encountered an attribute conflict/, - '... role attrs conflicted and method was required'; + '... role attrs conflict and method was required'; package My::Test8; use Moose; @@ -216,7 +216,7 @@ Role attribute conflicts ::throws_ok { with 'Role::Boo', 'Role::Boo::Hoo'; } qr/We have encountered an attribute conflict/, - '... role attrs conflicted and cannot be manually disambiguted'; + '... role attrs conflict and cannot be manually disambiguted'; } @@ -344,6 +344,28 @@ is(Role::Reality->meta->get_method('twist')->(), 'Role::Reality::twist', '... the twist method returns the right value'); +# Ovid's test case from rt.cpan.org #44 +{ + package Role1; + use Moose::Role; + + sub foo {} +} +{ + package Role2; + use Moose::Role; + + sub foo {} +} +{ + package Conflicts; + use Moose; + + ::throws_ok { + with qw(Role1 Role2); + } qr/Due to a method name conflict in roles 'Role1' and 'Role2', the method 'foo' must be implemented or excluded by 'Conflicts'/; +} + =pod Role conflicts between attributes and methods @@ -551,3 +573,5 @@ isa_ok($test26, 'My::Test26'); is($test26->ghost, 'My::Test26::ghost', '... we access the attribute from the class and ignore the role attribute and method'); =cut + +done_testing;