use strictures 1;
use Test::More;
+my $c_ran;
{
package Foo;
has six => (is => 'ro', builder => 1);
sub _build_six { {} }
has seven => (is => 'ro', required => 1, default => quote_sub q{ {} });
+ has eight => (is => 'ro', builder => '_build_eight', coerce => sub { $c_ran = 1; $_[0] });
+ sub _build_eight { {} }
+ has nine => (is => 'lazy', coerce => sub { $c_ran = 1; $_[0] });
+ sub _build_nine { {} }
}
sub check {
check seven => map Foo->new->{seven}, 1..2;
+check eight => map Foo->new->{eight}, 1..2;
+ok($c_ran, 'coerce defaults');
+
+$c_ran = 0;
+
+check nine => map Foo->new->nine, 1..2;
+ok($c_ran, 'coerce lazy default');
+
done_testing;