Add test file from ether (it passes now)
[gitmo/MooseX-ClassAttribute.git] / t / 09-bare-native-traits.t
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 );