Test::Deep is already required; use it instead of is_deeply
[gitmo/MooseX-Storage.git] / t / 007_false.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 8;
7 use Test::Deep;
8
9 BEGIN {
10     use_ok('MooseX::Storage');
11 }
12
13 {
14
15     package Foo;
16     use Moose;
17     use MooseX::Storage;
18
19     with Storage;
20
21     has 'number'  => ( is => 'ro', isa => 'Int', default => 42 );
22     has 'string'  => ( is => 'ro', isa => 'Str', default => "true" );
23     has 'boolean' => ( is => 'ro', isa => 'Bool', default => 1 );
24 }
25
26 {
27     my $foo = Foo->new(
28         number  => 0,
29         string  => '',
30         boolean => 0,
31     );
32     isa_ok( $foo, 'Foo' );
33     
34     is($foo->boolean, 0, '... got the right boolean value');
35     
36     cmp_deeply(
37         $foo->pack,
38         {
39             __CLASS__ => 'Foo',
40             number    => 0,
41             string    => '',
42             boolean   => 0,
43         },
44         '... got the right frozen class'
45     );
46 }
47
48 {
49     my $foo = Foo->unpack(
50         {
51             __CLASS__ => 'Foo',
52             number    => 0,
53             string    => '',
54             boolean   => 0,
55         }        
56     );
57     isa_ok( $foo, 'Foo' );
58
59     is( $foo->number, 0,  '... got the right number' );
60     is( $foo->string, '', '... got the right string' );
61     ok( !$foo->boolean,   '... got the right boolean' );
62 }