X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmoose_util%2Fmoose_util_does_role.t;fp=t%2Fmoose_util%2Fmoose_util_does_role.t;h=2505c9d302df888c7c8d2f404636ed4c88979752;hb=094b6ec90bd199688b77c4143bf9925a9fce3d03;hp=26c1176253080c00a82b40940af739918e2d2983;hpb=0fcee15b99a3a2fb6895374bccab6323d519a1ae;p=gitmo%2FMoose.git diff --git a/t/moose_util/moose_util_does_role.t b/t/moose_util/moose_util_does_role.t index 26c1176..2505c9d 100644 --- a/t/moose_util/moose_util_does_role.t +++ b/t/moose_util/moose_util_does_role.t @@ -43,6 +43,18 @@ BEGIN { with 'Foo'; } +{ + package DoesMethod; + use Moose; + + sub does { + my $self = shift; + my ($role) = @_; + return 1 if $role eq 'Something::Else'; + return $self->SUPER::does(@_); + } +} + # Classes ok(does_role('Bar', 'Foo'), '... Bar does Foo'); @@ -69,6 +81,10 @@ ok(!does_role(1,'Foo'), '... 1 doesnt do Foo'); ok(!does_role('Quux', 'Foo'), '... Quux doesnt do Foo (does not die tho)'); +# overriding the does method works properly + +ok(does_role('DoesMethod', 'Something::Else'), '... can override the does method'); + # TODO: make the below work, maybe? # Self