X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F020_attributes%2F024_attribute_traits_parameterized.t;h=2561b34c6fae9789d066a85733d24e6610f1d200;hb=f4fce6c81b07df08698798d87f6e7c0080b639cc;hp=4f9578efa942ed4da74a32e6db3a652b272f5586;hpb=a73f0dc7c8fc131783e863d2985207e3c2a00277;p=gitmo%2FMoose.git diff --git a/t/020_attributes/024_attribute_traits_parameterized.t b/t/020_attributes/024_attribute_traits_parameterized.t index 4f9578e..2561b34 100644 --- a/t/020_attributes/024_attribute_traits_parameterized.t +++ b/t/020_attributes/024_attribute_traits_parameterized.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 4; { package My::Attribute::Trait; @@ -25,11 +25,31 @@ use Test::More tests => 2; }, }, ], + is => 'bare', ); +} + +{ + package My::Other::Class; + use Moose; + has foo => ( + traits => [ + 'My::Attribute::Trait' => { + alias => { + reversed_name => 'reversed', + }, + }, + ], + is => 'bare', + ); } my $attr = My::Class->meta->get_attribute('foo'); is($attr->eman, 'oof', 'the aliased method is in the attribute'); -ok(!$attr->can('reversed_name'), 'the method was not installed under its original name'); +ok(!$attr->can('reversed'), "the method was not installed under the other class' alias"); + +my $other_attr = My::Other::Class->meta->get_attribute('foo'); +is($other_attr->reversed, 'oof', 'the aliased method is in the attribute'); +ok(!$other_attr->can('enam'), "the method was not installed under the other class' alias");