From: Dave Rolsky Date: Mon, 14 Feb 2011 03:26:16 +0000 (-0600) Subject: Add test file from ether (it passes now) X-Git-Tag: v0.23~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-ClassAttribute.git;a=commitdiff_plain;h=ca1f996bfae2f6a627ac026cd2d5288e2900c3e1 Add test file from ether (it passes now) --- diff --git a/t/09-bare-native-traits.t b/t/09-bare-native-traits.t new file mode 100644 index 0000000..60baa93 --- /dev/null +++ b/t/09-bare-native-traits.t @@ -0,0 +1,32 @@ +# 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::Fatal; + +{ + 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', + }, + ); +} + +is( + exception { Foo->has_attr('key') }, + undef, + 'Default builder in a native attribute trait is properly run when the attribute is defined with no standard accessors' +);