6 use Test::More tests => 14;
10 use_ok('MooseX::Storage');
21 has 'number' => ( is => 'ro', isa => 'Int' );
22 has 'string' => ( is => 'ro', isa => 'Str' );
23 has 'boolean' => ( is => 'ro', isa => 'Bool' );
24 has 'float' => ( is => 'ro', isa => 'Num' );
25 has 'array' => ( is => 'ro', isa => 'ArrayRef' );
26 has 'hash' => ( is => 'ro', isa => 'HashRef' );
27 has 'object' => ( is => 'ro', isa => 'Foo' );
28 has 'union' => ( is => 'ro', isa => 'ArrayRef|Str' );
29 has 'union2' => ( is => 'ro', isa => 'ArrayRef|Str' );
39 hash => { map { $_ => undef } ( 1 .. 10 ) },
40 object => Foo->new( number => 2 ),
44 isa_ok( $foo, 'Foo' );
55 hash => { map { $_ => undef } ( 1 .. 10 ) },
63 '... got the right frozen class'
68 my $foo = Foo->unpack(
76 hash => { map { $_ => undef } ( 1 .. 10 ) },
85 isa_ok( $foo, 'Foo' );
87 is( $foo->number, 10, '... got the right number' );
88 is( $foo->string, 'foo', '... got the right string' );
89 ok( $foo->boolean, '... got the right boolean' );
90 is( $foo->float, 10.5, '... got the right float' );
91 cmp_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
94 { map { $_ => undef } ( 1 .. 10 ) },
95 '... got the right hash'
98 isa_ok( $foo->object, 'Foo' );
99 is( $foo->object->number, 2,
100 '... got the right number (in the embedded object)' );
101 cmp_deeply( $foo->union, [ 1 .. 3 ], '... got the right array (in the union)' );
102 is( $foo->union2, 'A String', '... got the right string (in the union)' );