merged with delegation_bugs branch
[gitmo/MooseX-ClassAttribute.git] / t / 09-bare-native-attribute-trait.t
CommitLineData
a9d2b1a7 1
2# reported in https://rt.cpan.org/Public/Bug/Display.html?id=59573
3
4use strict;
5use warnings;
6
7use Test::More tests => 2;
8use Test::NoWarnings;
9use Test::Exception;
10
11{
12 package Foo;
13 use Moose;
14 use MooseX::ClassAttribute;
15 class_has attr => (
16 is => 'bare', isa => 'HashRef[Str]',
17 lazy => 1,
18 default => sub { {} },
19 traits => ['Hash'],
20 handles => {
21 has_attr => 'exists',
22 },
23 );
24}
25
26package main;
27
28# in Moose 1.08/MooseX::ClassAttribute 0.16, this dies with:
29# Can't use an undefined value as a HASH reference
30lives_ok { Foo->has_attr('key') }
31 'Default builder in a native attribute trait is properly run when the attribute is defined with no standard accessors';
32
33