4e3c6768e9a6e6f6687d29200475173ed1292d40
[dbsrgits/DBM-Deep.git] / t / 25_tie_return_value.t
1 use strict;
2
3 use Test::More tests => 5;
4 use File::Temp qw( tempfile tempdir );
5
6 use_ok( 'DBM::Deep' );
7
8 my $dir = tempdir( CLEANUP => 1 );
9
10 use Scalar::Util qw( reftype );
11
12 {
13     my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
14
15     my %hash;
16     my $obj = tie %hash, 'DBM::Deep', $filename;
17     isa_ok( $obj, 'DBM::Deep' );
18     is( reftype( $obj ), 'HASH', "... and its underlying representation is an HASH" );
19 }
20
21 {
22     my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
23
24     my @array;
25     my $obj = tie @array, 'DBM::Deep', $filename;
26     isa_ok( $obj, 'DBM::Deep' );
27     is( reftype( $obj ), 'HASH', "... and its underlying representation is an HASH" );
28 }