Move is_valid_class_name into XS
[gitmo/Mouse.git] / t / 001_mouse / 059-weak-with-default.t
1 #!perl
2 use strict;
3 use warnings;
4 use Test::More tests => 6;
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 is($o->lazy_weak_with_default, undef);
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);
37 is($o->lazy_weak_with_default, undef);