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 | |
4b757b92 |
6 | use Test::More; |
ca1f996b |
7 | use 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 | |
27 | is( |
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 | |
33 | done_testing(); |