Commit | Line | Data |
46389f86 |
1 | use strictures 1; |
2 | use Test::More; |
3 | |
4 | { |
5 | package Foo; |
6 | |
7 | use Sub::Quote; |
8 | use Class::Tiny; |
9 | |
10 | has one => (is => 'ro', lazy => 1, default => quote_sub q{ {} }); |
11 | has two => (is => 'ro', lazy => 1, builder => '_build_two'); |
12 | sub _build_two { {} } |
13 | has three => (is => 'ro', default => quote_sub q{ {} }); |
649ac264 |
14 | has four => (is => 'ro', builder => '_build_four'); |
46389f86 |
15 | sub _build_four { {} } |
16 | } |
17 | |
18 | sub check { |
19 | my ($attr, @h) = @_; |
20 | |
21 | is_deeply($h[$_], {}, "${attr}: empty hashref \$h[$_]") for 0..1; |
22 | |
23 | isnt($h[0],$h[1], "${attr}: not the same hashref"); |
24 | } |
25 | |
26 | check one => map Foo->new->one, 1..2; |
27 | |
28 | check two => map Foo->new->two, 1..2; |
29 | |
649ac264 |
30 | check three => map Foo->new->{three}, 1..2; |
31 | |
32 | check four => map Foo->new->{four}, 1..2; |
33 | |
46389f86 |
34 | done_testing; |