From: rkinyon Date: Thu, 27 Sep 2007 02:25:04 +0000 (+0000) Subject: Added test that breaks the dumper X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=990141bb604f0e2acd309c11b53d15aeb63ccf5e;p=dbsrgits%2FDBM-Deep.git Added test that breaks the dumper --- diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index da8445d..00313d8 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -889,8 +889,8 @@ sub _dump_file { my %sizes = ( 'D' => $self->data_sector_size, - 'B' => 387, - 'I' => 1234, + 'B' => DBM::Deep::Engine::Sector::BucketList->new({engine=>$self,offset=>1})->size, + 'I' => DBM::Deep::Engine::Sector::Index->new({engine=>$self,offset=>1})->size, ); # Read the free sector chains diff --git a/t/01_basic.t b/t/01_basic.t index 8c9c430..7025ea9 100644 --- a/t/01_basic.t +++ b/t/01_basic.t @@ -25,16 +25,3 @@ if ( $@ ) { isa_ok( $db, 'DBM::Deep' ); ok(1, "We can successfully open a file!" ); -__END__ -$db->{foo} = [ 1 ]; -$db->{bar} = $db->{foo}; - -warn -s $filename, $/; -warn $db->_dump_file; - -warn $/; - -delete $db->{foo}; -$db->{bar} = 'x'; -warn -s $filename, $/; -warn $db->_dump_file; diff --git a/t/100_dump_file.t b/t/100_dump_file.t new file mode 100644 index 0000000..d7abaae --- /dev/null +++ b/t/100_dump_file.t @@ -0,0 +1,35 @@ +use strict; +use Test::More tests => 1; + +use t::common qw( new_fh ); + +diag "Testing DBM::Deep against Perl $] located at $^X"; + +use_ok( 'DBM::Deep' ); + +my ($fh, $filename) = new_fh(); +my $db = DBM::Deep->new( + file => $filename, + num_txns => 2, +); + +$db->{foo} = []; +#$db->{bar} = $db->{foo}; + +warn -s $filename, $/; +warn $db->_dump_file, $/; + +$db->begin_work; + + delete $db->{foo}; +# delete $db->{bar}; + + warn -s $filename, $/; + warn $db->_dump_file, $/; + +# XXX Committing seems to break the dumper +$db->commit; +#$db->rollback; + +warn -s $filename, $/; +warn $db->_dump_file, $/;