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');
84 my $foo = Foo->thaw(q{---
115 isa_ok( $foo, 'Foo' );
117 is( $foo->number, 10, '... got the right number' );
118 is( $foo->string, 'foo', '... got the right string' );
119 is( $foo->float, 10.5, '... got the right float' );
120 is_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
123 { map { $_ => undef } ( 1 .. 10 ) },
124 '... got the right hash'
127 isa_ok( $foo->object, 'Foo' );
128 is( $foo->object->number, 2,
129 '... got the right number (in the embedded object)' );