6 BEGIN { plan tests => 10 }
11 # testing the various modes of opening a file
16 my $db = tie %hash, 'DBM::Deep', 't/test.db';
19 print "ERROR: " . $db->error();
23 else { ok(1, "Tied an hash with an array for params" ); }
29 my $db = tie %hash, 'DBM::Deep', {
34 print "ERROR: " . $db->error();
38 else { ok(1, "Tied a hash with a hashref for params" ); }
44 my $db = tie @array, 'DBM::Deep', 't/test.db';
47 print "ERROR: " . $db->error();
51 else { ok(1, "Tied an array with an array for params" ); }
53 is( $db->{type}, DBM::Deep->TYPE_ARRAY, "TIE_ARRAY sets the correct type" );
59 my $db = tie @array, 'DBM::Deep', {
64 print "ERROR: " . $db->error();
68 else { ok(1, "Tied an array with a hashref for params" ); }
70 is( $db->{type}, DBM::Deep->TYPE_ARRAY, "TIE_ARRAY sets the correct type" );
73 # These are testing the naive use of ref() within TIEHASH and TIEARRAY.
74 # They should be doing (Scalar::Util::reftype($_[0]) eq 'HASH') and then
75 # erroring out if it's not.
77 todo_skip "Naive use of ref()", 1;
80 my $db = tie %hash, 'DBM::Deep', [
85 print "ERROR: " . $db->error();
93 todo_skip "Naive use of ref()", 1;
96 my $db = tie @array, 'DBM::Deep', [
101 print "ERROR: " . $db->error();
108 # These are testing the naive use of the {@_} construct within TIEHASH and
109 # TIEARRAY. Instead, they should be checking (@_ % 2 == 0) and erroring out
112 todo_skip( "Naive use of {\@_}", 1 );
115 my $db = tie %hash, 'DBM::Deep',
116 undef, file => 't/test.db'
120 print "ERROR: " . $db->error();
128 todo_skip( "Naive use of {\@_}", 1 );
131 my $db = tie @array, 'DBM::Deep',
132 undef, file => 't/test.db'
136 print "ERROR: " . $db->error();