X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F09-bare-native-attribute-trait.t;fp=t%2F09-bare-native-attribute-trait.t;h=32a3b3191a7a7da02d227744308860558db87a54;hb=a9d2b1a78f09fa9f0413953fb089ba0918e5da13;hp=0000000000000000000000000000000000000000;hpb=d0f129f508a6f1cc66edd10eb50005c01ca6bee5;p=gitmo%2FMooseX-ClassAttribute.git diff --git a/t/09-bare-native-attribute-trait.t b/t/09-bare-native-attribute-trait.t new file mode 100644 index 0000000..32a3b31 --- /dev/null +++ b/t/09-bare-native-attribute-trait.t @@ -0,0 +1,33 @@ + +# reported in https://rt.cpan.org/Public/Bug/Display.html?id=59573 + +use strict; +use warnings; + +use Test::More tests => 2; +use Test::NoWarnings; +use Test::Exception; + +{ + package Foo; + use Moose; + use MooseX::ClassAttribute; + class_has attr => ( + is => 'bare', isa => 'HashRef[Str]', + lazy => 1, + default => sub { {} }, + traits => ['Hash'], + handles => { + has_attr => 'exists', + }, + ); +} + +package main; + +# in Moose 1.08/MooseX::ClassAttribute 0.16, this dies with: +# Can't use an undefined value as a HASH reference +lives_ok { Foo->has_attr('key') } + 'Default builder in a native attribute trait is properly run when the attribute is defined with no standard accessors'; + +