From: Graham Knop Date: Sun, 5 May 2013 14:23:36 +0000 (-0400) Subject: test for attribute attributes coming from traits X-Git-Tag: v1.003000~78 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b826c41baa95eb7fa3d3eb2e4282bb7526939e2a;p=gitmo%2FMoo.git test for attribute attributes coming from traits --- diff --git a/xt/moo-does-moose-role.t b/xt/moo-does-moose-role.t index ff9f6d2..1fd7c57 100644 --- a/xt/moo-does-moose-role.t +++ b/xt/moo-does-moose-role.t @@ -234,4 +234,21 @@ is( Plonker->meta->find_attribute_by_name('kk')->documentation, 'parentchild', 'moosify applies for overridden attributes with roles'); +{ + package MooseAttrTrait; + use Moose::Role; + + has 'extra_attr' => (is => 'ro'); +} + +{ + package UsingMooseTrait; + use Moo; + + has one => (is => 'ro', traits => ['MooseAttrTrait'], extra_attr => 'one'); +} + +ok(UsingMooseTrait->meta->find_attribute_by_name('one')->can('extra_attr'), 'trait was properly applied'); +is(UsingMooseTrait->meta->find_attribute_by_name('one')->extra_attr, 'one', 'trait attributes maintain values'); + done_testing;