Test::Deep is already required; use it instead of is_deeply
[gitmo/MooseX-Storage.git] / t / 007_false.t
CommitLineData
669c0055 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
917411c2 6use Test::More tests => 8;
619ab942 7use Test::Deep;
669c0055 8
9BEGIN {
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' );
b5f363ac 33
917411c2 34 is($foo->boolean, 0, '... got the right boolean value');
b5f363ac 35
619ab942 36 cmp_deeply(
669c0055 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,
b5f363ac 55 }
669c0055 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}