From: jhuckaby Date: Thu, 16 Feb 2006 08:33:03 +0000 (+0000) Subject: converted TODO test into real one (corrupted master index) X-Git-Tag: 0-97~67 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e9d4578ce0c56f1b206f8a4367908486c1b7e1d;p=dbsrgits%2FDBM-Deep.git converted TODO test into real one (corrupted master index) added type mismatch test (create hash, try to re-open as array) --- diff --git a/t/07error.t b/t/07error.t index 77cc955..1a15be2 100644 --- a/t/07error.t +++ b/t/07error.t @@ -2,7 +2,7 @@ # DBM::Deep Test ## use strict; -use Test::More tests => 4; +use Test::More tests => 5; use_ok( 'DBM::Deep' ); @@ -16,19 +16,32 @@ if ($db->error()) { # cause an error ## eval { $db->push("foo"); }; # ERROR -- array-only method - ok( $db->error() ); +## +# make sure you can clear the error state +## $db->clear_error(); - ok( !$db->error() ); undef $db; +## +# test a corrupted file +## open FH, '>t/test.db'; print FH 'DPDB'; close FH; -$db = DBM::Deep->new( "t/test.db" ); -TODO: { - local $TODO = "The return value from load_tag() isn't checked in open()"; - ok( $db->error() ); -} +eval { $db = DBM::Deep->new( "t/test.db" ); }; +ok( $@ ); + +## +# test a file type mismatch +## +unlink "t/test.db"; +my %hash; +tie %hash, 'DBM::Deep', 't/test.db'; +$hash{'foo'} = 'bar'; +undef %hash; +my @array; +eval { tie @array, 'DBM::Deep', 't/test.db'; }; +ok( $@ );