9 eval "use Test::YAML::Valid";
10 plan skip_all => "Test::YAML::Valid is required for this test" if $@;
12 use_ok('MooseX::Storage');
21 with Storage( 'format' => 'YAML' );
23 has 'number' => ( is => 'ro', isa => 'Int' );
24 has 'string' => ( is => 'ro', isa => 'Str' );
25 has 'float' => ( is => 'ro', isa => 'Num' );
26 has 'array' => ( is => 'ro', isa => 'ArrayRef' );
27 has 'hash' => ( is => 'ro', isa => 'HashRef' );
28 has 'object' => ( is => 'ro', isa => 'Object' );
37 hash => { map { $_ => undef } ( 1 .. 10 ) },
38 object => Foo->new( number => 2 ),
40 isa_ok( $foo, 'Foo' );
42 my $yaml = $foo->freeze;
44 yaml_string_ok( $yaml, '... we got valid YAML out of it' );
79 '... got the same YAML'
118 isa_ok( $foo, 'Foo' );
120 is( $foo->number, 10, '... got the right number' );
121 is( $foo->string, 'foo', '... got the right string' );
122 is( $foo->float, 10.5, '... got the right float' );
123 is_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
126 { map { $_ => undef } ( 1 .. 10 ) },
127 '... got the right hash'
130 isa_ok( $foo->object, 'Foo' );
131 is( $foo->object->number, 2,
132 '... got the right number (in the embedded object)' );