From: rkinyon Date: Fri, 28 Sep 2007 13:35:35 +0000 (+0000) Subject: Added a test for dump_file within the core tests and got all subs to be called at... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d005c2e8b71aa9dd286bf91db20e9b43d8a91e37;p=dbsrgits%2FDBM-Deep.git Added a test for dump_file within the core tests and got all subs to be called at least once in the core tests. --- diff --git a/MANIFEST b/MANIFEST index 6b774db..8862a0f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -59,6 +59,7 @@ t/42_transaction_indexsector.t t/43_transaction_maximum.t t/44_upgrade_db.t t/45_references.t +t/97_dump_file.t t/98_pod.t t/99_pod_coverage.t t/common.pm diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index 40028f2..bfb63de 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -319,9 +319,6 @@ sub clone { ); sub set_filter { - ## - # Setup filter function for storing or fetching the key or value - ## my $self = shift->_get_self; my $type = lc shift; my $func = shift; diff --git a/lib/DBM/Deep.pod b/lib/DBM/Deep.pod index eccea9e..2e3da4b 100644 --- a/lib/DBM/Deep.pod +++ b/lib/DBM/Deep.pod @@ -1034,6 +1034,17 @@ B report on this distribution's test suite. Total 97.2 87.4 83.9 100.0 100.0 94.6 ----------------------------------- ------ ------ ------ ------ ------ ------ + ------------------------------------------ ------ ------ ------ ------ ------ + File stmt bran cond sub total + ------------------------------------------ ------ ------ ------ ------ ------ + blib/lib/DBM/Deep.pm 94.5 85.0 90.5 100.0 93.6 + blib/lib/DBM/Deep/Array.pm 100.0 94.3 100.0 100.0 98.7 + blib/lib/DBM/Deep/Engine.pm 95.9 84.9 81.7 100.0 92.8 + blib/lib/DBM/Deep/File.pm 97.2 81.6 66.7 100.0 91.9 + blib/lib/DBM/Deep/Hash.pm 100.0 100.0 100.0 100.0 100.0 + Total 96.5 86.5 83.5 100.0 94.0 + ------------------------------------------ ------ ------ ------ ------ ------ + =head1 MORE INFORMATION Check out the DBM::Deep Google Group at L diff --git a/t/100_dump_file.t b/t/100_dump_file.t deleted file mode 100644 index a99e73f..0000000 --- a/t/100_dump_file.t +++ /dev/null @@ -1,40 +0,0 @@ -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, $/; - -$db->{foo} = 1; - -warn -s $filename, $/; -warn $db->_dump_file, $/; diff --git a/t/14_filter.t b/t/14_filter.t index 240e96d..fbff9b1 100644 --- a/t/14_filter.t +++ b/t/14_filter.t @@ -53,10 +53,10 @@ ok( exists $db->{key2}, "Key2 exists" ); ## # Now clear all filters, and make sure all is unfiltered ## -ok( $db->set_filter( 'store_key', undef ), "Unset store_key filter" ); -ok( $db->set_filter( 'store_value', undef ), "Unset store_value filter" ); -ok( $db->set_filter( 'fetch_key', undef ), "Unset fetch_key filter" ); -ok( $db->set_filter( 'fetch_value', undef ), "Unset fetch_value filter" ); +ok( $db->filter_store_key( undef ), "Unset store_key filter" ); +ok( $db->filter_store_value( undef ), "Unset store_value filter" ); +ok( $db->filter_fetch_key( undef ), "Unset fetch_key filter" ); +ok( $db->filter_fetch_value( undef ), "Unset fetch_value filter" ); is( $db->{MYFILTERkey2}, "MYFILTERvalue2", "We get the right unfiltered value" ); diff --git a/t/97_dump_file.t b/t/97_dump_file.t new file mode 100644 index 0000000..931cb07 --- /dev/null +++ b/t/97_dump_file.t @@ -0,0 +1,32 @@ +use strict; +use Test::More tests => 3; +use Test::Deep; +use t::common qw( new_fh ); + +use_ok( 'DBM::Deep' ); + +my ($fh, $filename) = new_fh(); +my $db = DBM::Deep->new( + file => $filename, +); + +is( $db->_dump_file, <<"__END_DUMP__", "Dump of initial file correct" ); +Chains(B): +Chains(D): +Chains(I): +00000030: H 0064 REF: 1 +__END_DUMP__ + +$db->{foo} = 'bar'; + +is( $db->_dump_file, <<"__END_DUMP__", "Dump of initial file correct" ); +Chains(B): +Chains(D): +Chains(I): +00000030: H 0064 REF: 1 +00000094: D 0064 bar +00000158: B 0387 + 00000545 00000094 +00000545: D 0064 foo +__END_DUMP__ +