#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 30;
+use Test::More tests => 34;
my $builder_called = 0;
my $lazy_builder_called = 0;
isa => 'Str',
builder => '_build_name',
predicate => 'has_name',
+ clearer => 'clear_name',
);
sub _build_name {
is($builder_called, 0, "builder not called in the setter");
$builder_called = 0;
+$object->clear_name;
+ok(!$object->has_name, "predicate: no value after clear");
+is($object->name, undef, "eager builder does NOT swoop in after clear");
+ok(!$object->has_name, "predicate: no value after clear and get");
+is($builder_called, 0, "builder not called in the getter, even after clear");
+$builder_called = 0;
+
my $object2 = Class->new;
ok($object2->has_name, "predicate: value from eager builder");
is($object2->name, "FRANK", "builder called to provide the default value");