9 eval "use Test::YAML::Valid";
10 plan skip_all => "Test::YAML::Valid is required for this test" if $@;
11 eval "use Best [[qw(YAML::Syck YAML)]]";
12 plan skip_all => "YAML or YAML::syck and Best are required for this test" if $@;
14 use_ok('MooseX::Storage');
23 with Storage( 'format' => 'YAML' );
25 has 'number' => ( is => 'ro', isa => 'Int' );
26 has 'string' => ( is => 'ro', isa => 'Str' );
27 has 'float' => ( is => 'ro', isa => 'Num' );
28 has 'array' => ( is => 'ro', isa => 'ArrayRef' );
29 has 'hash' => ( is => 'ro', isa => 'HashRef' );
30 has 'object' => ( is => 'ro', isa => 'Object' );
39 hash => { map { $_ => undef } ( 1 .. 10 ) },
40 object => Foo->new( number => 2 ),
42 isa_ok( $foo, 'Foo' );
44 my $yaml = $foo->freeze;
46 yaml_string_ok( $yaml, '... we got valid YAML out of it' );
81 '... got the same YAML'
120 isa_ok( $foo, 'Foo' );
122 is( $foo->number, 10, '... got the right number' );
123 is( $foo->string, 'foo', '... got the right string' );
124 is( $foo->float, 10.5, '... got the right float' );
125 is_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
128 { map { $_ => undef } ( 1 .. 10 ) },
129 '... got the right hash'
132 isa_ok( $foo->object, 'Foo' );
133 is( $foo->object->number, 2,
134 '... got the right number (in the embedded object)' );