Standardized test incantations
[dbsrgits/DBM-Deep.git] / t / 31_references.t
index 2becbe2..af9bc30 100644 (file)
@@ -1,17 +1,13 @@
-##
-# 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 = (
@@ -24,8 +20,8 @@ $db->{hash} = \%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 );
@@ -44,8 +40,8 @@ $db->{array} = \@array;
 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 );
@@ -58,6 +54,6 @@ is( $db->{array}[2]{b}, 'floober' );
 
 my %hash2 = ( abc => [ 1 .. 3 ] );
 $array[3] = \%hash2;
-$hash2{ def } = \%hash;
 
+$hash2{ def } = \%hash;
 is( $array[3]{def}{foo}, 2 );