the repository now lives at https://github.com/moose/MooseX-ClassAttributes
[gitmo/MooseX-ClassAttribute.git] / t / 09-bare-native-traits.t
CommitLineData
ca1f996b 1# reported in https://rt.cpan.org/Public/Bug/Display.html?id=59573
2
3use strict;
4use warnings;
5
4b757b92 6use Test::More;
ca1f996b 7use Test::Fatal;
8
9{
10 package Foo;
11
12 use Moose;
13 use MooseX::ClassAttribute;
14
15 class_has attr => (
16 is => 'bare',
17 isa => 'HashRef[Str]',
18 lazy => 1,
19 default => sub { {} },
20 traits => ['Hash'],
21 handles => {
22 has_attr => 'exists',
23 },
24 );
25}
26
27is(
28 exception { Foo->has_attr('key') },
29 undef,
30 'Default builder in a native attribute trait is properly run when the attribute is defined with no standard accessors'
31);
4b757b92 32
33done_testing();