10 'YAML::Any' => 0.01, # skip all if not installed
12 'Test::Without::Module' => 0.01,
16 Test::Without::Module->import(YAML::Any->order);
17 Test::Without::Module->unimport('YAML');
19 use_ok('MooseX::Storage');
28 with Storage( 'format' => 'YAML' );
30 has 'number' => ( is => 'ro', isa => 'Int' );
31 has 'string' => ( is => 'ro', isa => 'Str' );
32 has 'float' => ( is => 'ro', isa => 'Num' );
33 has 'array' => ( is => 'ro', isa => 'ArrayRef' );
34 has 'hash' => ( is => 'ro', isa => 'HashRef' );
35 has 'object' => ( is => 'ro', isa => 'Object' );
44 hash => { map { $_ => undef } ( 1 .. 10 ) },
45 object => Foo->new( number => 2 ),
47 isa_ok( $foo, 'Foo' );
49 my $yaml = $foo->freeze;
51 my $bar = Foo->thaw( $yaml );
52 isa_ok( $bar, 'Foo' );
54 is( $bar->number, 10, '... got the right number' );
55 is( $bar->string, 'foo', '... got the right string' );
56 is( $bar->float, 10.5, '... got the right float' );
57 cmp_deeply( $bar->array, [ 1 .. 10 ], '... got the right array' );
60 { map { $_ => undef } ( 1 .. 10 ) },
61 '... got the right hash'
64 isa_ok( $bar->object, 'Foo' );
65 is( $bar->object->number, 2,
66 '... got the right number (in the embedded object)' );