Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 300_immutable / 101-immutable-default.t
CommitLineData
9864f0e4 1use strict;
2use warnings;
3
4use Test::More tests => 5;
5use 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
19lives_ok { Foo->meta->make_immutable }
20 'Immutable meta with single BUILD';
21
22my $f = Foo->new;
23isa_ok $f, 'Foo';
24is $f->foos, 'DEFAULT', 'str default';
25is $f->bars, 300100, 'int default';
26is ref($f->bazs), 'HASH', 'code default';
27