2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
8 ## lazy_build sets required => 1
9 ## required does not permit setting to undef
11 ## Possible solutions:
12 #### remove required => 1
13 #### check the attr to see if it accepts Undef (Maybe[], | Undef)
14 #### or, make required accept undef and use a predicate test
17 has 'foo' => ( isa => 'Int | Undef', is => 'rw', lazy_build => 1 );
18 has 'bar' => ( isa => 'Int | Undef', is => 'rw' );
20 sub _build_foo { undef }
25 ok ( !defined(Foo->new->bar), 'NonLazyBuild: Undef default' );
26 ok ( !defined(Foo->new->bar(undef)), 'NonLazyBuild: Undef explicit' );
28 ok ( !defined(Foo->new->foo), 'LazyBuild: Undef default/lazy_build' );
30 ## This test fails at the time of creation.
31 ok ( !defined(Foo->new->foo(undef)), 'LazyBuild: Undef explicit' );