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