update repo to point to github
[gitmo/Moo.git] / xt / moose-autoclean-lazy-attr-builders.t
1 use strict;
2 use warnings;
3 # when using an Moose object and namespace::autoclean
4 # lazy attributes that get a value on initialize still
5 # have their builders run
6
7 {
8     package MyMooseObject;
9     use Moose;
10 }
11
12 {
13     package BadObject;
14     use Moo;
15     # use MyMooseObject <- this is inferred here
16     use namespace::autoclean;
17
18     has attr => ( is => 'lazy' );
19     sub _build_attr {2}
20 }
21
22 use Test::More;
23 # use BadObject <- this is inferred here
24
25 is(
26     BadObject->new( attr => 1 )->attr,
27     1,
28     q{namespace::autoclean doesn't run builders with default},
29 );
30
31 done_testing;