X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F25_tie_return_value.t;h=e14c319b0ef9bcf91fb1a3ae8b268325c5d3c116;hb=96041a257f0523eaa1e0d0a1e6e4c98120618464;hp=dfb875a7ba3a7fdf6cd7590e17bbc445c56f45e5;hpb=30029562a3dd7c413ce7db129bb1904849e454e3;p=dbsrgits%2FDBM-Deep.git diff --git a/t/25_tie_return_value.t b/t/25_tie_return_value.t index dfb875a..e14c319 100644 --- a/t/25_tie_return_value.t +++ b/t/25_tie_return_value.t @@ -1,28 +1,31 @@ use strict; use Test::More tests => 5; - -use Scalar::Util qw( reftype ); +use File::Temp qw( tempfile tempdir ); +use Fcntl qw( :flock ); use_ok( 'DBM::Deep' ); +my $dir = tempdir( CLEANUP => 1 ); + +use Scalar::Util qw( reftype ); + { - unlink "t/test.db"; + my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir ); + flock $fh, LOCK_UN; my %hash; - my $obj = tie %hash, 'DBM::Deep', 't/test.db'; + my $obj = tie %hash, 'DBM::Deep', $filename; isa_ok( $obj, 'DBM::Deep' ); is( reftype( $obj ), 'HASH', "... and its underlying representation is an HASH" ); } { - unlink "t/test.db"; + my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir ); + flock $fh, LOCK_UN; my @array; - my $obj = tie @array, 'DBM::Deep', 't/test.db'; + my $obj = tie @array, 'DBM::Deep', $filename; isa_ok( $obj, 'DBM::Deep' ); - TODO: { - local $TODO = "_init() returns a blessed hashref"; - is( reftype( $obj ), 'ARRAY', "... and its underlying representation is an ARRAY" ); - } + is( reftype( $obj ), 'HASH', "... and its underlying representation is an HASH" ); }