Test::Deep is already required; use it instead of is_deeply
[gitmo/MooseX-Storage.git] / t / 009_do_not_serialize_lazy.t
CommitLineData
76218b46 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More 'no_plan';#tests => 6;
619ab942 7use Test::Deep;
9d3c60f5 8use Test::Fatal;
76218b46 9
10BEGIN {
11 use_ok('MooseX::Storage');
12}
13
14{ package Point;
15 use Moose;
16 use MooseX::Storage;
17
18 with Storage( traits => [qw|OnlyWhenBuilt|] );
19
20 has 'x' => (is => 'rw', lazy_build => 1 );
21 has 'y' => (is => 'rw', lazy_build => 1 );
22 has 'z' => (is => 'rw', builder => '_build_z' );
b5f363ac 23
24
76218b46 25 sub _build_x { 'x' }
26 sub _build_y { 'y' }
27 sub _build_z { 'z' }
28
29}
30
31my $p = Point->new( 'x' => $$ );
32ok( $p, "New object created" );
33
34my $href = $p->pack;
35
36ok( $href, " Object packed" );
37is( $href->{'x'}, $$, " x => $$" );
38is( $href->{'z'}, 'z', " z => z" );
39ok( not(exists($href->{'y'})), " y does not exist" );
40
619ab942 41cmp_deeply(
b5f363ac 42 $href,
76218b46 43 { '__CLASS__' => 'Point',
44 'x' => $$,
45 'z' => 'z'
46 }, " Deep check passed" );