Commit | Line | Data |
434bcb42 |
1 | #!perl |
2 | use strict; |
3 | use warnings; |
8aba926d |
4 | use Test::More tests => 6; |
434bcb42 |
5 | |
6 | { |
7 | package MyClass; |
8 | use Mouse; |
9 | |
10 | has lazy_weak_with_default => ( |
11 | is => 'rw', |
12 | isa => 'Ref', |
13 | weak_ref => 1, |
14 | lazy => 1, |
15 | default => sub{ [] }, |
16 | ); |
17 | |
18 | has weak_with_default => ( |
19 | is => 'rw', |
20 | isa => 'Ref', |
21 | weak_ref => 1, |
22 | default => sub{ [] }, |
23 | ); |
24 | |
25 | } |
26 | |
27 | my $o = MyClass->new(); |
28 | is($o->weak_with_default, undef); |
29 | is($o->lazy_weak_with_default, undef); |
8aba926d |
30 | is($o->lazy_weak_with_default, undef); |
434bcb42 |
31 | |
32 | MyClass->meta->make_immutable(); |
33 | |
34 | $o = MyClass->new(); |
35 | is($o->weak_with_default, undef); |
36 | is($o->lazy_weak_with_default, undef); |
8aba926d |
37 | is($o->lazy_weak_with_default, undef); |