X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_basic.t;h=aeeb86ebba192be082a0161daa630d3ee6fbada6;hb=9b2ca73cb6e813fb041f5c013c38d115236976d9;hp=beb218c4a455b7be9154e0f17c8ebb7365599838;hpb=260cc81f7ab424f417900ab1c44b734b339f9d9e;p=gitmo%2FMoose-Autobox.git diff --git a/t/001_basic.t b/t/001_basic.t index beb218c..aeeb86e 100644 --- a/t/001_basic.t +++ b/t/001_basic.t @@ -3,14 +3,13 @@ use strict; use warnings; -use Test::More tests => 55; +use Test::More tests => 58; BEGIN { use_ok('Moose::Autobox'); - use_ok('Moose::Autobox::Undef'); } -use autobox UNDEF => 'Moose::Autobox::Undef'; +use Moose::Autobox; # SCALAR & UNDEF @@ -93,6 +92,12 @@ is_deeply($a, [ 4, 2, 6, 78, 101, 2 ], '... original value is now changed'); is($a->shift(), 4, '... got the right unshift-ed value'); is_deeply($a, [ 2, 6, 78, 101, 2 ], '... original value is now changed'); + +is_deeply( +$a->slice([ 1, 2, 4 ]), +[ 6, 78, 2 ], +'... got the right sliced value'); + is_deeply( $a->unshift(10), [ 10, 2, 6, 78, 101, 2 ], @@ -169,6 +174,16 @@ $a, [ 15, 20, 30, 10, 2, 6, 78, 101, 2, 10, 15, 20, 30 ], '... the value is correctly put'); +my $expected_dump = qr/^\$VAR1\s*=\s*\[\s*15,\s*20,\s*30,\s*10,\s*2,\s*6,\s*78,\s*101,\s*2,\s*10,\s*15,\s*20,\s*30\s*\]\s*;\s*$/msx; + +like( $a->dump, + $expected_dump, + '... the value is correctly dumped' ); +is( $a->dump, + $a->perl, + '... the value is correctly dumped with perl()' ); + + # Hash my $h = { one => 1, two => 2, three => 3 }; @@ -207,4 +222,9 @@ $h, { one => 1, two => 2, three => 3 }, '... got the value deleted correctly'); +is_deeply( +$h->merge({ three => 33, four => 44 }), +{ one => 1, two => 2, three => 33, four => 44 }, +'... got the hashes merged correctly'); +