use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 13;
use Test::Exception;
BEGIN {
metaclass => 'DoNotSerialize',
required => 1,
is => 'rw',
+ isa => 'Str', # type constraint is important
);
has zot => (
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 => $$");
}