-##
-# DBM::Deep Test
-##
use strict;
+
use Test::More tests => 16;
+use Test::Deep;
use Test::Exception;
-use File::Temp qw( tempfile tempdir );
-use Fcntl qw( :flock );
+use t::common qw( new_fh );
use_ok( 'DBM::Deep' );
-my $dir = tempdir( CLEANUP => 1 );
-my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
-flock $fh, LOCK_UN;
+my ($fh, $filename) = new_fh();
my $db = DBM::Deep->new( $filename );
my %hash = (
isa_ok( tied(%hash), 'DBM::Deep::Hash' );
is( $db->{hash}{foo}, 1 );
-is_deeply( $db->{hash}{bar}, [ 1 .. 3 ] );
-is_deeply( $db->{hash}{baz}, { a => 42 } );
+cmp_deeply( $db->{hash}{bar}, noclass([ 1 .. 3 ]) );
+cmp_deeply( $db->{hash}{baz}, noclass({ a => 42 }) );
$hash{foo} = 2;
is( $db->{hash}{foo}, 2 );
isa_ok( tied(@array), 'DBM::Deep::Array' );
is( $db->{array}[0], 1 );
-is_deeply( $db->{array}[1], [ 1 .. 3 ] );
-is_deeply( $db->{array}[2], { a => 42 } );
+cmp_deeply( $db->{array}[1], noclass([ 1 .. 3 ]) );
+cmp_deeply( $db->{array}[2], noclass({ a => 42 }) );
$array[0] = 2;
is( $db->{array}[0], 2 );
my %hash2 = ( abc => [ 1 .. 3 ] );
$array[3] = \%hash2;
-$hash2{ def } = \%hash;
+$hash2{ def } = \%hash;
is( $array[3]{def}{foo}, 2 );