X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F46_blist_reindex.t;h=771284729a59972158e1f9eb28fbc244112bd22c;hb=0e3e35555b9d0f781548d4d383f601ba69837310;hp=d6e009d1b8c6ad1e90c89fb89af38e53d20ebe1f;hpb=4f0f6fff0474a896cad8bbb80d8c0ccce3d87bf9;p=dbsrgits%2FDBM-Deep.git diff --git a/t/46_blist_reindex.t b/t/46_blist_reindex.t index d6e009d..7712847 100644 --- a/t/46_blist_reindex.t +++ b/t/46_blist_reindex.t @@ -1,62 +1,64 @@ # This test (and accompanying patch) was submitted by Father Chrysostomos (sprout@cpan.org) -use 5.006; - use strict; use warnings FATAL => 'all'; -use Test::More tests => 5; +use Test::More; -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( $filename ); + my $dbm_factory = new_dbm(); + while ( my $dbm_maker = $dbm_factory->() ) { + my $db = $dbm_maker->(); - ok eval { - for ( # the checksums of all these begin with ^@: + ok eval { + for ( # the checksums of all these begin with ^@: + qw/ s340l 1970 thronos /, + "\320\277\320\276\320\262\320\265\320\273\320\265\320\275". + "\320\275\320\276\320\265", qw/ mr094 despite + geographically binding bed handmaiden infer lela infranarii + lxv evtropia recognizes maladies / + ) { + $db->{$_} = undef; + } + 1; + }, '2 indices can be created at once'; + + is_deeply [sort keys %$db], [ sort qw/ s340l 1970 thronos /, "\320\277\320\276\320\262\320\265\320\273\320\265\320\275". "\320\275\320\276\320\265", qw/ mr094 despite geographically binding bed handmaiden infer lela infranarii lxv evtropia recognizes maladies / - ) { - $db->{$_} = undef; - } - 1; - }, '2 indices can be created at once'; - - is_deeply [sort keys %$db], [ sort - qw/ s340l 1970 thronos /, - "\320\277\320\276\320\262\320\265\320\273\320\265\320\275". - "\320\275\320\276\320\265", qw/ mr094 despite - geographically binding bed handmaiden infer lela infranarii - lxv evtropia recognizes maladies / - ], 'and the keys were stored correctly'; + ], 'and the keys were stored correctly'; + } } { - my ($fh, $filename) = new_fh(); - my $db = DBM::Deep->new( $filename ); + my $dbm_factory = new_dbm(); + while ( my $dbm_maker = $dbm_factory->() ) { + my $db = $dbm_maker->(); - ok eval { - for ( # the checksums of all these begin with ^@^@^@: + ok eval { + for ( # the checksums of all these begin with ^@^@^@: + qw/ dzqtz aqkdqz cxzysd czclmy ktajsi kvlybo kyxowd lvlsda + lyzfdi mbethb mcoqeq VMPJC ATZMZZ AXXJDX BXUUFN EIVTII + FMOKOI HITVDG JSSJSZ JXQPFK LCVVXW / + ) { + $db->{$_} = undef; + } + 1; + }, 'multiple nested indices can be created at once'; + + is_deeply [sort keys %$db], [ sort qw/ dzqtz aqkdqz cxzysd czclmy ktajsi kvlybo kyxowd lvlsda lyzfdi mbethb mcoqeq VMPJC ATZMZZ AXXJDX BXUUFN EIVTII FMOKOI HITVDG JSSJSZ JXQPFK LCVVXW / - ) { - $db->{$_} = undef; - } - 1; - }, 'multiple nested indices can be created at once'; - - is_deeply [sort keys %$db], [ sort - qw/ dzqtz aqkdqz cxzysd czclmy ktajsi kvlybo kyxowd lvlsda - lyzfdi mbethb mcoqeq VMPJC ATZMZZ AXXJDX BXUUFN EIVTII - FMOKOI HITVDG JSSJSZ JXQPFK LCVVXW / - ], 'and the keys were stored correctly'; + ], 'and the keys were stored correctly'; + } } -__END__ +done_testing;