From: Shawn M Moore Date: Sun, 14 Dec 2008 21:30:14 +0000 (+0000) Subject: Exploding tests for attribute traits => [role => parameters] X-Git-Tag: 0.64~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a73f0dc7c8fc131783e863d2985207e3c2a00277;p=gitmo%2FMoose.git Exploding tests for attribute traits => [role => parameters] --- diff --git a/t/020_attributes/024_attribute_traits_parameterized.t b/t/020_attributes/024_attribute_traits_parameterized.t new file mode 100644 index 0000000..4f9578e --- /dev/null +++ b/t/020_attributes/024_attribute_traits_parameterized.t @@ -0,0 +1,35 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 2; + +{ + package My::Attribute::Trait; + use Moose::Role; + + sub reversed_name { + my $self = shift; + scalar reverse $self->name; + } +} + +{ + package My::Class; + use Moose; + + has foo => ( + traits => [ + 'My::Attribute::Trait' => { + alias => { + reversed_name => 'eman', + }, + }, + ], + ); + +} + +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'); +