From: 大沢 和宏 Date: Fri, 5 Dec 2008 16:55:38 +0000 (+0000) Subject: add immutable test X-Git-Tag: 0.19~136^2~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ee0db4b62e2a49b409feb11f3efd58822c686246;p=gitmo%2FMouse.git add immutable test --- diff --git a/t/300_immutable/101-immutable-default.t b/t/300_immutable/101-immutable-default.t new file mode 100644 index 0000000..6fcbf2b --- /dev/null +++ b/t/300_immutable/101-immutable-default.t @@ -0,0 +1,27 @@ +use strict; +use warnings; + +use Test::More tests => 5; +use Test::Exception; + +{ + package Foo; + use Mouse; + + #two checks because the inlined methods are different when + #there is a TC present. + has 'foos' => ( is => 'rw', default => 'DEFAULT' ); + has 'bars' => ( is => 'rw', default => 300100 ); + has 'bazs' => ( is => 'rw', default => sub { +{} } ); + +} + +lives_ok { Foo->meta->make_immutable } + 'Immutable meta with single BUILD'; + +my $f = Foo->new; +isa_ok $f, 'Foo'; +is $f->foos, 'DEFAULT', 'str default'; +is $f->bars, 300100, 'int default'; +is ref($f->bazs), 'HASH', 'code default'; +