Commit | Line | Data |
434bcb42 |
1 | #!perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More tests => 4; |
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); |
30 | |
31 | MyClass->meta->make_immutable(); |
32 | |
33 | $o = MyClass->new(); |
34 | is($o->weak_with_default, undef); |
35 | is($o->lazy_weak_with_default, undef); |