X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F003_basic_w_embedded_objects.t;h=03ef4af32659b919e33988a9696384b0119dab7c;hb=1d4669291edf1495a90d5b110a6334b05ca1cc78;hp=7c69094025a6f000e8cc3997c08756ea736106e6;hpb=ba5bba75ba0c4f8af075e95ce3b00e5376bedf5c;p=gitmo%2FMooseX-Storage.git diff --git a/t/003_basic_w_embedded_objects.t b/t/003_basic_w_embedded_objects.t index 7c69094..03ef4af 100644 --- a/t/003_basic_w_embedded_objects.t +++ b/t/003_basic_w_embedded_objects.t @@ -1,9 +1,8 @@ -#!/usr/bin/perl - use strict; use warnings; -use Test::More no_plan => 1; +use Test::More tests => 47; +use Test::Deep; BEGIN { use_ok('MooseX::Storage'); @@ -11,8 +10,8 @@ BEGIN { =pod -This test checks the single level -expansion and collpasing of the +This test checks the single level +expansion and collpasing of the ArrayRef and HashRef type handlers. =cut @@ -23,30 +22,30 @@ ArrayRef and HashRef type handlers. use MooseX::Storage; with Storage; - + has 'number' => (is => 'ro', isa => 'Int'); - + package Foo; use Moose; use MooseX::Storage; - with Storage; + with Storage; - has 'bars' => ( - is => 'ro', - isa => 'ArrayRef' + has 'bars' => ( + is => 'ro', + isa => 'ArrayRef' ); - + package Baz; use Moose; use MooseX::Storage; - with Storage; + with Storage; - has 'bars' => ( - is => 'ro', - isa => 'HashRef' - ); + has 'bars' => ( + is => 'ro', + isa => 'HashRef' + ); } { @@ -54,19 +53,19 @@ ArrayRef and HashRef type handlers. bars => [ map { Bar->new(number => $_) } (1 .. 10) ] ); isa_ok( $foo, 'Foo' ); - - is_deeply( + + cmp_deeply( $foo->pack, { __CLASS__ => 'Foo', - bars => [ + bars => [ map { { __CLASS__ => 'Bar', number => $_, - } + } } (1 .. 10) - ], + ], }, '... got the right frozen class' ); @@ -76,15 +75,15 @@ ArrayRef and HashRef type handlers. my $foo = Foo->unpack( { __CLASS__ => 'Foo', - bars => [ + bars => [ map { { __CLASS__ => 'Bar', number => $_, - } + } } (1 .. 10) - ], - } + ], + } ); isa_ok( $foo, 'Foo' ); @@ -100,8 +99,8 @@ ArrayRef and HashRef type handlers. bars => { map { ($_ => Bar->new(number => $_)) } (1 .. 10) } ); isa_ok( $baz, 'Baz' ); - - is_deeply( + + cmp_deeply( $baz->pack, { __CLASS__ => 'Baz', @@ -110,9 +109,9 @@ ArrayRef and HashRef type handlers. ($_ => { __CLASS__ => 'Bar', number => $_, - }) + }) } (1 .. 10) - }, + }, }, '... got the right frozen class' ); @@ -127,10 +126,10 @@ ArrayRef and HashRef type handlers. ($_ => { __CLASS__ => 'Bar', number => $_, - }) + }) } (1 .. 10) - }, - } + }, + } ); isa_ok( $baz, 'Baz' );