6 use Test::More no_plan => 1;
9 use_ok('MooseX::Storage');
17 with Storage(format => 'YAML', io => 'File');
19 has 'number' => (is => 'ro', isa => 'Int');
20 has 'string' => (is => 'ro', isa => 'Str');
21 has 'float' => (is => 'ro', isa => 'Num');
22 has 'array' => (is => 'ro', isa => 'ArrayRef');
23 has 'hash' => (is => 'ro', isa => 'HashRef');
24 has 'object' => (is => 'ro', isa => 'Object');
27 my $file = 'temp.yaml';
35 hash => { map { $_ => undef } (1 .. 10) },
36 object => Foo->new( number => 2 ),
44 my $foo = Foo->load($file);
47 is($foo->number, 10, '... got the right number');
48 is($foo->string, 'foo', '... got the right string');
49 is($foo->float, 10.5, '... got the right float');
50 is_deeply($foo->array, [ 1 .. 10], '... got the right array');
51 is_deeply($foo->hash, { map { $_ => undef } (1 .. 10) }, '... got the right hash');
53 isa_ok($foo->object, 'Foo');
54 is($foo->object->number, 2, '... got the right number (in the embedded object)');