Support modifier by regexp
[gitmo/Mouse.git] / t / 300_immutable / 101-immutable-default.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 5;
5 use Test::Exception;
6
7 {
8     package Foo;
9     use Mouse;
10
11     #two checks because the inlined methods are different when
12     #there is a TC present.
13     has 'foos' => ( is => 'rw', default => 'DEFAULT' );
14     has 'bars' => ( is => 'rw', default => 300100 );
15     has 'bazs' => ( is => 'rw', default => sub { +{} } );
16
17 }
18
19 lives_ok { Foo->meta->make_immutable }
20     'Immutable meta with single BUILD';
21
22 my $f = Foo->new;
23 isa_ok $f, 'Foo';
24 is $f->foos, 'DEFAULT', 'str default';
25 is $f->bars, 300100, 'int default';
26 is ref($f->bazs), 'HASH', 'code default';
27