X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F008_do_not_serialize.t;fp=t%2F008_do_not_serialize.t;h=e0ff4b3dee752bbea8cbfb0acb4ad9d0496d0f93;hb=335eb37774e94d72fe990375dd4fd647e6275395;hp=adc8e140d3899f46efe1d0f47a4c3485051d4a3c;hpb=76b60811edb8232e205ef3ca18427edf2efbde4a;p=gitmo%2FMooseX-Storage.git diff --git a/t/008_do_not_serialize.t b/t/008_do_not_serialize.t index adc8e14..e0ff4b3 100644 --- a/t/008_do_not_serialize.t +++ b/t/008_do_not_serialize.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 13; use Test::Exception; BEGIN { @@ -65,6 +65,7 @@ BEGIN { metaclass => 'DoNotSerialize', required => 1, is => 'rw', + isa => 'Str', # type constraint is important ); has zot => ( @@ -86,8 +87,12 @@ BEGIN { zot => $$, }, " Packed correctly" ); + eval { Bar->unpack( $bpack ) }; + ok( $@, " Unpack without required attribute fails" ); + like( $@, qr/foo/, " Proper error recorded" ); + my $bar2 = Bar->unpack({ %$bpack, foo => $$ }); - ok( $bar2, " Unpacked correctly by supplying foo => $$"); + ok( $bar2, " Unpacked correctly with foo => $$"); }