4 use Test::More tests => 14;
8 use_ok('MooseX::Storage');
19 has 'number' => ( is => 'ro', isa => 'Int' );
20 has 'string' => ( is => 'ro', isa => 'Str' );
21 has 'boolean' => ( is => 'ro', isa => 'Bool' );
22 has 'float' => ( is => 'ro', isa => 'Num' );
23 has 'array' => ( is => 'ro', isa => 'ArrayRef' );
24 has 'hash' => ( is => 'ro', isa => 'HashRef' );
25 has 'object' => ( is => 'ro', isa => 'Foo' );
26 has 'union' => ( is => 'ro', isa => 'ArrayRef|Str' );
27 has 'union2' => ( is => 'ro', isa => 'ArrayRef|Str' );
37 hash => { map { $_ => undef } ( 1 .. 10 ) },
38 object => Foo->new( number => 2 ),
42 isa_ok( $foo, 'Foo' );
53 hash => { map { $_ => undef } ( 1 .. 10 ) },
61 '... got the right frozen class'
66 my $foo = Foo->unpack(
74 hash => { map { $_ => undef } ( 1 .. 10 ) },
83 isa_ok( $foo, 'Foo' );
85 is( $foo->number, 10, '... got the right number' );
86 is( $foo->string, 'foo', '... got the right string' );
87 ok( $foo->boolean, '... got the right boolean' );
88 is( $foo->float, 10.5, '... got the right float' );
89 cmp_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
92 { map { $_ => undef } ( 1 .. 10 ) },
93 '... got the right hash'
96 isa_ok( $foo->object, 'Foo' );
97 is( $foo->object->number, 2,
98 '... got the right number (in the embedded object)' );
99 cmp_deeply( $foo->union, [ 1 .. 3 ], '... got the right array (in the union)' );
100 is( $foo->union2, 'A String', '... got the right string (in the union)' );