X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F39_singletons.t;h=93526a4002b43436163cb311b998cf7aea719cd8;hb=0e3e35555b9d0f781548d4d383f601ba69837310;hp=3676b48dd98eecf1f468bed87a69168f36fc9bf8;hpb=4f0f6fff0474a896cad8bbb80d8c0ccce3d87bf9;p=dbsrgits%2FDBM-Deep.git diff --git a/t/39_singletons.t b/t/39_singletons.t index 3676b48..93526a4 100644 --- a/t/39_singletons.t +++ b/t/39_singletons.t @@ -1,17 +1,18 @@ use strict; -use Test::More tests => 11; +use warnings FATAL => 'all'; + +use Test::More; use Test::Deep; -use t::common qw( new_fh ); +use t::common qw( new_dbm ); use_ok( 'DBM::Deep' ); -{ - my ($fh, $filename) = new_fh(); - my $db = DBM::Deep->new( - file => $filename, - locking => 1, - autoflush => 1, - ); +my $dbm_factory = new_dbm( + locking => 1, + autoflush => 1, +); +while ( my $dbm_maker = $dbm_factory->() ) { + my $db = $dbm_maker->(); $db->{a} = 1; $db->{foo} = { a => 'b' }; @@ -40,25 +41,29 @@ use_ok( 'DBM::Deep' ); SKIP: { skip "What do we do with external references and txns?", 2; - my ($fh, $filename) = new_fh(); - my $db = DBM::Deep->new( - file => $filename, - locking => 1, + + my $dbm_factory = new_dbm( + locking => 1, autoflush => 1, - num_txns => 2, + num_txns => 2, ); + while ( my $dbm_maker = $dbm_factory->() ) { + my $db = $dbm_maker->(); - $db->{foo} = { a => 'b' }; - my $x = $db->{foo}; + $db->{foo} = { a => 'b' }; + my $x = $db->{foo}; - $db->begin_work; + $db->begin_work; - $db->{foo} = { c => 'd' }; - my $y = $db->{foo}; + $db->{foo} = { c => 'd' }; + my $y = $db->{foo}; - # XXX What should happen here with $x and $y? - is( $x, $y ); - is( $x->{c}, 'd' ); + # XXX What should happen here with $x and $y? + is( $x, $y ); + is( $x->{c}, 'd' ); - $db->rollback; + $db->rollback; + } } + +done_testing;