6 use Test::More no_plan => 1;
18 has 'number' => (is => 'ro', isa => 'Int');
19 has 'string' => (is => 'ro', isa => 'Str');
20 has 'float' => (is => 'ro', isa => 'Num');
21 has 'array' => (is => 'ro', isa => 'ArrayRef');
22 has 'hash' => (is => 'ro', isa => 'HashRef');
23 has 'object' => (is => 'ro', isa => 'Object');
26 my $file = 'temp.json';
34 hash => { map { $_ => undef } (1 .. 10) },
35 object => Foo->new( number => 2 ),
43 my $foo = Foo->load($file);
46 is($foo->number, 10, '... got the right number');
47 is($foo->string, 'foo', '... got the right string');
48 is($foo->float, 10.5, '... got the right float');
49 is_deeply($foo->array, [ 1 .. 10], '... got the right array');
50 is_deeply($foo->hash, { map { $_ => undef } (1 .. 10) }, '... got the right hash');
52 isa_ok($foo->object, 'Foo');
53 is($foo->object->number, 2, '... got the right number (in the embedded object)');