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
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 ],
[ 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 };
{ 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');
+