summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t')
-rwxr-xr-xgnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t70
1 files changed, 5 insertions, 65 deletions
diff --git a/gnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t b/gnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t
index 8d55647b01d..e738cc454d6 100755
--- a/gnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t
+++ b/gnu/usr.bin/perl/cpan/Memoize/t/tie_gdbm.t
@@ -1,68 +1,8 @@
-#!/usr/bin/perl
-
-use lib qw(. ..);
-use Memoize 0.45 qw(memoize unmemoize);
+use strict; use warnings;
use Fcntl;
-sub i {
- $_[0];
-}
-
-sub c119 { 119 }
-sub c7 { 7 }
-sub c43 { 43 }
-sub c23 { 23 }
-sub c5 { 5 }
-
-sub n {
- $_[0]+1;
-}
-
-eval {require GDBM_File};
-if ($@) {
- print "1..0\n";
- exit 0;
-}
-
-print "1..4\n";
-
-$file = "md$$";
-1 while unlink $file, "$file.dir", "$file.pag";
-tryout('GDBM_File', $file, 1); # Test 1..4
-1 while unlink $file, "$file.dir", "$file.pag";
-
-sub tryout {
- require GDBM_File;
- my ($tiepack, $file, $testno) = @_;
-
- tie my %cache => $tiepack, $file, &GDBM_File::GDBM_NEWDB, 0666
- or die $!;
-
- memoize 'c5',
- SCALAR_CACHE => [HASH => \%cache],
- LIST_CACHE => 'FAULT'
- ;
-
- my $t1 = c5();
- my $t2 = c5();
- print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
- $testno++;
- print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
- unmemoize 'c5';
-
- # Now something tricky---we'll memoize c23 with the wrong table that
- # has the 5 already cached.
- memoize 'c23',
- SCALAR_CACHE => [HASH => \%cache],
- LIST_CACHE => 'FAULT'
- ;
-
- my $t3 = c23();
- my $t4 = c23();
- $testno++;
- print (($t3 == 5) ? "ok $testno\n" : "not ok $testno\n");
- $testno++;
- print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");
- unmemoize 'c23';
-}
+use lib 't/lib';
+use DBMTest 'GDBM_File', is_scalar_only => 1;
+test_dbm $file, &GDBM_File::GDBM_WRCREAT, 0666;
+cleanup;