X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F036-with-method-alias.t;fp=t%2F036-with-method-alias.t;h=c1976ab11f870157830dc053e153438e1707addc;hb=4aaa2ed6a8f267aa74bfbbab9b6880a900ca6063;hp=0000000000000000000000000000000000000000;hpb=b1b8155380073bc8170b50b17893474865604300;p=gitmo%2FMouse.git diff --git a/t/036-with-method-alias.t b/t/036-with-method-alias.t new file mode 100644 index 0000000..c1976ab --- /dev/null +++ b/t/036-with-method-alias.t @@ -0,0 +1,43 @@ +use strict; +use warnings; +use Test::More tests => 5; + +{ + package Animal; + use Mouse::Role; + sub eat { 'delicious' } +} + +{ + package Cat; + use Mouse::Role; + with 'Animal', { + alias => { eat => 'drink' }, + }; + sub eat { 'good!' } +} + +{ + package Tama; + use Mouse; + with 'Cat'; +} + +{ + package Dog; + use Mouse; + with 'Animal', { + alias => { eat => 'drink' } + }; +} + +ok(!Dog->can('eat')); +ok(Dog->can('drink')); + +my $d = Dog->new(); +is($d->drink(), 'delicious'); + +my $t = Tama->new; +is $t->drink(), 'delicious'; +is $t->eat(), 'good!'; +