From: Dave Rolsky Date: Fri, 11 Sep 2009 01:30:28 +0000 (-0500) Subject: Add a test for aliasing a method in a class without excluding in to-class role applic... X-Git-Tag: 0.89_02~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa858c3dbcd3ff89dc5feccb3911f39c2918476e;p=gitmo%2FMoose.git Add a test for aliasing a method in a class without excluding in to-class role application. We end up with both the aliased method name and the original (which is expected). --- diff --git a/t/030_roles/013_method_aliasing_in_composition.t b/t/030_roles/013_method_aliasing_in_composition.t index d16ff10..5d7480d 100644 --- a/t/030_roles/013_method_aliasing_in_composition.t +++ b/t/030_roles/013_method_aliasing_in_composition.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 35; +use Test::More tests => 38; use Test::Exception; @@ -147,3 +147,14 @@ 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"); ok(My::Foo::Role::Other->meta->requires_method('foo_foo'), '... and the &foo method is required'); +{ + package My::Foo::AliasOnly; + use Moose; + + ::lives_ok { + with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' } }, + } '... composed our roles correctly'; +} + +ok(My::Foo::AliasOnly->meta->has_method('foo'), 'we have a foo method'); +ok(My::Foo::AliasOnly->meta->has_method('foo_foo'), '.. and the aliased foo_foo method');