6 use Test::More tests => 14;
9 use_ok('MooseX::Storage');
20 has 'number' => ( is => 'ro', isa => 'Int' );
21 has 'string' => ( is => 'ro', isa => 'Str' );
22 has 'boolean' => ( is => 'ro', isa => 'Bool' );
23 has 'float' => ( is => 'ro', isa => 'Num' );
24 has 'array' => ( is => 'ro', isa => 'ArrayRef' );
25 has 'hash' => ( is => 'ro', isa => 'HashRef' );
26 has 'object' => ( is => 'ro', isa => 'Foo' );
27 has 'union' => ( is => 'ro', isa => 'ArrayRef|Str' );
28 has 'union2' => ( is => 'ro', isa => 'ArrayRef|Str' );
38 hash => { map { $_ => undef } ( 1 .. 10 ) },
39 object => Foo->new( number => 2 ),
43 isa_ok( $foo, 'Foo' );
54 hash => { map { $_ => undef } ( 1 .. 10 ) },
62 '... got the right frozen class'
67 my $foo = Foo->unpack(
75 hash => { map { $_ => undef } ( 1 .. 10 ) },
84 isa_ok( $foo, 'Foo' );
86 is( $foo->number, 10, '... got the right number' );
87 is( $foo->string, 'foo', '... got the right string' );
88 ok( $foo->boolean, '... got the right boolean' );
89 is( $foo->float, 10.5, '... got the right float' );
90 is_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
93 { map { $_ => undef } ( 1 .. 10 ) },
94 '... got the right hash'
97 isa_ok( $foo->object, 'Foo' );
98 is( $foo->object->number, 2,
99 '... got the right number (in the embedded object)' );
100 is_deeply( $foo->union, [ 1 .. 3 ], '... got the right array (in the union)' );
101 is( $foo->union2, 'A String', '... got the right string (in the union)' );