5 use Test::More tests => 11;
11 # testing the various modes of opening a file
16 my $db = tie %hash, 'DBM::Deep', 't/test.db';
18 ok(1, "Tied an hash with an array for params" );
24 my $db = tie %hash, 'DBM::Deep', {
28 ok(1, "Tied a hash with a hashref for params" );
34 my $db = tie @array, 'DBM::Deep', 't/test.db';
36 ok(1, "Tied an array with an array for params" );
38 is( $db->{type}, DBM::Deep->TYPE_ARRAY, "TIE_ARRAY sets the correct type" );
44 my $db = tie @array, 'DBM::Deep', {
48 ok(1, "Tied an array with a hashref for params" );
50 is( $db->{type}, DBM::Deep->TYPE_ARRAY, "TIE_ARRAY sets the correct type" );
55 tie my %hash, 'DBM::Deep', [ file => 't/test.db' ];
56 } qr/Not a hashref/, "Passing an arrayref to TIEHASH fails";
60 tie my @array, 'DBM::Deep', [ file => 't/test.db' ];
61 } qr/Not a hashref/, "Passing an arrayref to TIEARRAY fails";
65 tie my %hash, 'DBM::Deep', undef, file => 't/test.db';
66 } qr/Odd number of parameters/, "Odd number of params to TIEHASH fails";
70 tie my @array, 'DBM::Deep', undef, file => 't/test.db';
71 } qr/Odd number of parameters/, "Odd number of params to TIEARRAY fails";