Fix compatibility tests
[gitmo/Mouse.git] / t / 001_mouse / 059-weak-with-default.t
CommitLineData
434bcb42 1#!perl
2use strict;
3use warnings;
4use 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
27my $o = MyClass->new();
28is($o->weak_with_default, undef);
29is($o->lazy_weak_with_default, undef);
30
31MyClass->meta->make_immutable();
32
33$o = MyClass->new();
34is($o->weak_with_default, undef);
35is($o->lazy_weak_with_default, undef);