remove the outstanding queue from Sub::Quote; benchamarks show it didn't actually...
[gitmo/Role-Tiny.git] / t / accessor-pred-clear.t
CommitLineData
8f333548 1use strictures 1;
2use Test::More;
3
4{
5 package Foo;
6
b1eebd55 7 use Moo;
8f333548 8
9 has one => (
10 is => 'ro', lazy => 1, default => sub { 3 },
11 predicate => 'has_one', clearer => 'clear_one'
12 );
13}
14
15my $foo = Foo->new;
16
17ok(!$foo->has_one, 'empty');
18is($foo->one, 3, 'lazy default');
19ok($foo->has_one, 'not empty now');
20is($foo->clear_one, 3, 'clearer returns value');
21ok(!$foo->has_one, 'clearer empties');
22is($foo->one, 3, 'default re-fired');
23ok($foo->has_one, 'not empty again');
24
25done_testing;