From: Rob Kinyon Date: Wed, 25 Nov 2009 14:28:51 +0000 (-0500) Subject: Standardized test incantations X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=33d7395d5a547dbfa64f0bcf3a42f04cd84db1dc;p=dbsrgits%2FDBM-Deep.git Standardized test incantations --- diff --git a/t/02_hash.t b/t/02_hash.t index 6e9972a..fd13c02 100644 --- a/t/02_hash.t +++ b/t/02_hash.t @@ -9,10 +9,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( - file => $filename, - fh => $fh, -); +my $db = DBM::Deep->new( $filename ); ## # put/get key @@ -116,10 +113,7 @@ is( $db->get("key1"), "value222222222222222222222222", "We set a value before cl ## undef $db; open $fh, '+<', $filename; -$db = DBM::Deep->new( - file => $filename, - fh => $fh, -); +$db = DBM::Deep->new( $filename ); is( $db->get("key1"), "value222222222222222222222222", "The value we set is still there after closure" ); ## diff --git a/t/04_array.t b/t/04_array.t index 24b52ec..ce86362 100644 --- a/t/04_array.t +++ b/t/04_array.t @@ -11,7 +11,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new( file => $filename, - fh => $fh, type => DBM::Deep->TYPE_ARRAY ); diff --git a/t/07_locking.t b/t/07_locking.t index 9c0232a..de35154 100644 --- a/t/07_locking.t +++ b/t/07_locking.t @@ -11,7 +11,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new( file => $filename, - fh => $fh, locking => 1, ); diff --git a/t/08_deephash.t b/t/08_deephash.t index 5e022c3..e13ed7c 100644 --- a/t/08_deephash.t +++ b/t/08_deephash.t @@ -21,7 +21,6 @@ my $max_levels = 1000; { my $db = DBM::Deep->new( file => $filename, - fh => $fh, type => DBM::Deep->TYPE_HASH, ); @@ -54,7 +53,6 @@ my $max_levels = 1000; open $fh, '+<', $filename; my $db = DBM::Deep->new( file => $filename, - fh => $fh, type => DBM::Deep->TYPE_HASH, ); diff --git a/t/09_deeparray.t b/t/09_deeparray.t index 1fe9d0f..a9260e6 100644 --- a/t/09_deeparray.t +++ b/t/09_deeparray.t @@ -21,7 +21,6 @@ my $max_levels = 1000; { my $db = DBM::Deep->new( file => $filename, - fh => $fh, type => DBM::Deep->TYPE_ARRAY, ); @@ -38,7 +37,6 @@ my $max_levels = 1000; open $fh, '+<', $filename; my $db = DBM::Deep->new( file => $filename, - fh => $fh, type => DBM::Deep->TYPE_ARRAY, ); diff --git a/t/16_circular.t b/t/16_circular.t index 9752816..501435d 100644 --- a/t/16_circular.t +++ b/t/16_circular.t @@ -8,7 +8,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( file => $filename, fh => $fh, ); +my $db = DBM::Deep->new( $filename ); ## # put/get simple keys diff --git a/t/17_import.t b/t/17_import.t index 108aae2..01fe311 100644 --- a/t/17_import.t +++ b/t/17_import.t @@ -14,7 +14,6 @@ foreach my $type ( DBM::Deep->TYPE_HASH, DBM::Deep->TYPE_ARRAY ) { my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, type => $type, }); @@ -50,7 +49,6 @@ foreach my $type ( DBM::Deep->TYPE_HASH, DBM::Deep->TYPE_ARRAY ) { my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, autobless => 1, }); @@ -98,7 +96,6 @@ foreach my $type ( DBM::Deep->TYPE_HASH, DBM::Deep->TYPE_ARRAY ) { my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, type => DBM::Deep->TYPE_ARRAY, }); @@ -132,7 +129,6 @@ foreach my $type ( DBM::Deep->TYPE_HASH, DBM::Deep->TYPE_ARRAY ) { my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, autobless => 1, }); diff --git a/t/18_export.t b/t/18_export.t index 1ff8051..949697a 100644 --- a/t/18_export.t +++ b/t/18_export.t @@ -27,7 +27,6 @@ my %struct = ( my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, autobless => 1, }); diff --git a/t/19_crossref.t b/t/19_crossref.t index ff99319..67a3589 100644 --- a/t/19_crossref.t +++ b/t/19_crossref.t @@ -9,7 +9,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh2, $filename2) = new_fh(); -my $db2 = DBM::Deep->new( file => $filename2, fh => $fh2, ); +my $db2 = DBM::Deep->new( $filename2 ); SKIP: { skip "Apparently, we cannot detect a tied scalar?", 1; @@ -35,7 +35,7 @@ SKIP: { { my ($fh, $filename) = new_fh(); - my $db = DBM::Deep->new( file => $filename, fh => $fh, ); + my $db = DBM::Deep->new( $filename ); ## # Create structure in $db diff --git a/t/22_internal_copy.t b/t/22_internal_copy.t index b17c009..bda4b1d 100644 --- a/t/22_internal_copy.t +++ b/t/22_internal_copy.t @@ -8,7 +8,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( file => $filename, fh => $fh, ); +my $db = DBM::Deep->new( $filename ); ## # Create structure in $db diff --git a/t/24_autobless.t b/t/24_autobless.t index 70ef1df..2126749 100644 --- a/t/24_autobless.t +++ b/t/24_autobless.t @@ -16,7 +16,6 @@ my ($fh, $filename) = new_fh(); { my $db = DBM::Deep->new( file => $filename, - fh => $fh, autobless => 1, ); @@ -163,7 +162,6 @@ my ($fh, $filename) = new_fh(); { my $db = DBM::Deep->new( file => $filename2, - fh => $fh2, autobless => 1, ); my $obj = bless { @@ -197,7 +195,6 @@ my ($fh, $filename) = new_fh(); my ($fh3, $filename3) = new_fh(); my $db = DBM::Deep->new( file => $filename3, - fh => $fh3, autobless => 1, ); diff --git a/t/31_references.t b/t/31_references.t index 4d46796..af9bc30 100644 --- a/t/31_references.t +++ b/t/31_references.t @@ -8,7 +8,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( file => $filename, fh => $fh, ); +my $db = DBM::Deep->new( $filename ); my %hash = ( foo => 1, diff --git a/t/38_data_sector_size.t b/t/38_data_sector_size.t index 01a612b..55f4e47 100644 --- a/t/38_data_sector_size.t +++ b/t/38_data_sector_size.t @@ -27,7 +27,6 @@ my %sizes; { my $db = DBM::Deep->new( file => $filename, - fh => $fh, data_sector_size => 32, ); @@ -48,7 +47,6 @@ my %sizes; { my $db = DBM::Deep->new( file => $filename, - fh => $fh, data_sector_size => 64, ); @@ -69,7 +67,6 @@ my %sizes; { my $db = DBM::Deep->new( file => $filename, - fh => $fh, data_sector_size => 128, ); @@ -90,7 +87,6 @@ my %sizes; { my $db = DBM::Deep->new( file => $filename, - fh => $fh, data_sector_size => 256, ); diff --git a/t/40_freespace.t b/t/40_freespace.t index d242710..2cf2f85 100644 --- a/t/40_freespace.t +++ b/t/40_freespace.t @@ -12,7 +12,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, autoflush => 1, }); @@ -64,7 +63,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new({ file => $filename, - fh => $fh, autoflush => 1, }); diff --git a/t/41_transaction_multilevel.t b/t/41_transaction_multilevel.t index 2c3c44a..584eb89 100644 --- a/t/41_transaction_multilevel.t +++ b/t/41_transaction_multilevel.t @@ -8,7 +8,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db1 = DBM::Deep->new( file => $filename, - fh => $fh, locking => 1, autoflush => 1, num_txns => 2, @@ -17,7 +16,6 @@ seek $db1->_get_self->_engine->storage->{fh}, 0, 0; my $db2 = DBM::Deep->new( file => $filename, - fh => $fh, locking => 1, autoflush => 1, num_txns => 2, diff --git a/t/45_references.t b/t/45_references.t index cb26d6d..a128f8e 100644 --- a/t/45_references.t +++ b/t/45_references.t @@ -11,7 +11,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new( file => $filename, - fh => $fh, locking => 1, autoflush => 1, num_txns => 16, @@ -21,7 +20,6 @@ seek $db->_get_self->_engine->storage->{fh}, 0, 0; my $db2 = DBM::Deep->new( file => $filename, - fh => $fh, locking => 1, autoflush => 1, num_txns => 16, diff --git a/t/47_odd_reference_behaviors.t b/t/47_odd_reference_behaviors.t index 956adcb..a7ccf73 100644 --- a/t/47_odd_reference_behaviors.t +++ b/t/47_odd_reference_behaviors.t @@ -16,7 +16,6 @@ use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); my $db = DBM::Deep->new( file => $filename, - fh => $fh, ); my $bar = bless { foo => 'ope' }, 'Foo'; @@ -33,10 +32,7 @@ use_ok( 'DBM::Deep' ); # This is bug #29957, reported by HANENKAMP { my ($fh, $filename) = new_fh(); - my $db = DBM::Deep->new( - file => $filename, - fh => $fh, - ); + my $db = DBM::Deep->new( $filename ); $db->{foo} = []; @@ -54,10 +50,7 @@ use_ok( 'DBM::Deep' ); # This is bug #33863, reported by PJS { my ($fh, $filename) = new_fh(); - my $db = DBM::Deep->new( - file => $filename, - fh => $fh, - ); + my $db = DBM::Deep->new( $filename ); $db->{foo} = [ 42 ]; my $foo = shift @{ $db->{foo} }; diff --git a/t/48_autoexport_after_delete.t b/t/48_autoexport_after_delete.t index 15ecaf8..253fa16 100644 --- a/t/48_autoexport_after_delete.t +++ b/t/48_autoexport_after_delete.t @@ -12,10 +12,7 @@ use_ok( 'DBM::Deep' ); { my ($fh, $filename) = t::common::new_fh(); - my $db = DBM::Deep->new( - file => $filename, - fh => $fh, - ); + my $db = DBM::Deep->new( $filename ); # Add a self-referencing connection to test export my %struct = ( diff --git a/t/50_deletes.t b/t/50_deletes.t index 0109cbb..50592ee 100644 --- a/t/50_deletes.t +++ b/t/50_deletes.t @@ -14,7 +14,7 @@ plan tests => $max + 1; use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( file => $filename, fh => $fh, ); +my $db = DBM::Deep->new( $filename ); my $x = 1; while( $x <= $max ) { diff --git a/t/52_memory_leak.t b/t/52_memory_leak.t index b24401b..2f5a593 100644 --- a/t/52_memory_leak.t +++ b/t/52_memory_leak.t @@ -14,7 +14,7 @@ plan skip_all => "Need to figure out what platforms this runs on"; use t::common qw( new_fh ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( file => $filename, fh => $fh, ); +my $db = DBM::Deep->new( $filename ); my $todo = 1000; my $allow = $todo*0.02; # NOTE: a 2% fail rate is hardly a failure diff --git a/t/53_misc_transactions.t b/t/53_misc_transactions.t index 8b8fe48..faa90c9 100644 --- a/t/53_misc_transactions.t +++ b/t/53_misc_transactions.t @@ -12,7 +12,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( file => $filename, fh => $fh ); +my $db = DBM::Deep->new( $filename ); eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures"); diff --git a/t/97_dump_file.t b/t/97_dump_file.t index 1445517..2c84f92 100644 --- a/t/97_dump_file.t +++ b/t/97_dump_file.t @@ -6,9 +6,7 @@ use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( - file => $filename, -); +my $db = DBM::Deep->new( $filename ); is( $db->_dump_file, <<"__END_DUMP__", "Dump of initial file correct" ); NumTxns: 1