summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/DBM_Filter/t/01error.t16
-rw-r--r--lib/DBM_Filter/t/02core.t70
-rw-r--r--lib/DBM_Filter/t/compress.t20
-rw-r--r--lib/DBM_Filter/t/encode.t20
-rw-r--r--lib/DBM_Filter/t/int32.t20
-rw-r--r--lib/DBM_Filter/t/null.t20
-rw-r--r--lib/DBM_Filter/t/utf8.t20
7 files changed, 128 insertions, 58 deletions
diff --git a/lib/DBM_Filter/t/01error.t b/lib/DBM_Filter/t/01error.t
index f66030aba9..e16d8d1329 100644
--- a/lib/DBM_Filter/t/01error.t
+++ b/lib/DBM_Filter/t/01error.t
@@ -45,7 +45,17 @@ print "# runFilter $name\n" ;
use Test::More tests => 21;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/ODBM_File SDBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
unlink <Op_dbmx*>;
@@ -53,9 +63,9 @@ END { unlink <Op_dbmx*>; }
my %h1 = () ;
my %h2 = () ;
-$db = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+$db = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db, "tied to SDBM_File ok";
+ok $db, "tied to $db_file ok";
# Error cases
diff --git a/lib/DBM_Filter/t/02core.t b/lib/DBM_Filter/t/02core.t
index 77a6a6ce71..a9538e52d1 100644
--- a/lib/DBM_Filter/t/02core.t
+++ b/lib/DBM_Filter/t/02core.t
@@ -33,7 +33,17 @@ END { unlink keys %files if keys %files }
use Test::More tests => 189;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
unlink <Op_dbmx*>;
@@ -151,7 +161,7 @@ sub checkRaw
my %h;
# read the dbm file without the filter
- ok tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640), "tied to SDBM_File";
+ ok tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640), "tied to $db_file";
my %bad = ();
while (my ($k, $v) = each %h) {
@@ -188,8 +198,8 @@ sub checkRaw
#diag "Test Set: Key and Value Filter, no stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -218,8 +228,8 @@ sub checkRaw
#diag "Test Set: Key Only Filter, no stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -248,8 +258,8 @@ sub checkRaw
#diag "Test Set: Value Only Filter, no stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -278,8 +288,8 @@ sub checkRaw
#diag "Test Set: Key and Value Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -311,8 +321,8 @@ sub checkRaw
#diag "Test Set: Key Filter != Value Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -350,8 +360,8 @@ sub checkRaw
#diag "Test Set: Key only Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -383,8 +393,8 @@ sub checkRaw
#diag "Test Set: Value only Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -416,8 +426,8 @@ sub checkRaw
#diag "Test Set: Combination Key/Value + Key Filter != Value Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -452,8 +462,8 @@ sub checkRaw
#diag "Test Set: Combination Key/Value + Key + Key/Value, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -488,8 +498,8 @@ sub checkRaw
#diag "Test Set: Combination Key/Value + Key + Key/Value, with closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -524,8 +534,8 @@ sub checkRaw
#diag "Test Set: Combination Key/Value + Key + Key/Value, immediate";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -569,8 +579,8 @@ sub checkRaw
#diag "Test Set: Combination Key/Value + Key + Key/Value, immediate, closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -608,8 +618,8 @@ sub checkRaw
#diag "Test Set: Filtered & Filter_Pop";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
@@ -692,8 +702,8 @@ sub checkRaw
}
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
diff --git a/lib/DBM_Filter/t/compress.t b/lib/DBM_Filter/t/compress.t
index b7f04bb57b..f9b1fe1219 100644
--- a/lib/DBM_Filter/t/compress.t
+++ b/lib/DBM_Filter/t/compress.t
@@ -17,7 +17,17 @@ require "dbm_filter_util.pl";
use Test::More tests => 23;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
BEGIN { use_ok('Compress::Zlib') };
@@ -25,9 +35,9 @@ unlink <Op_dbmx*>;
END { unlink <Op_dbmx*>; }
my %h1 = () ;
-my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db1, "tied to SDBM_File";
+ok $db1, "tied to $db_file";
# store before adding the filter
@@ -80,9 +90,9 @@ undef $db1;
# read the dbm file without the filter
my %h2 = () ;
-my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db2, "tied to SDBM_File";
+ok $db2, "tied to $db_file";
VerifyData(\%h2,
{
diff --git a/lib/DBM_Filter/t/encode.t b/lib/DBM_Filter/t/encode.t
index 2c3ee0bf43..b60fbb54e0 100644
--- a/lib/DBM_Filter/t/encode.t
+++ b/lib/DBM_Filter/t/encode.t
@@ -21,7 +21,17 @@ require "dbm_filter_util.pl";
use Test::More tests => 26;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
BEGIN { use_ok('charnames', qw{greek})};
@@ -31,9 +41,9 @@ unlink <Op_dbmx*>;
END { unlink <Op_dbmx*>; }
my %h1 = () ;
-my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db1, "tied to SDBM_File";
+ok $db1, "tied to $db_file";
eval { $db1->Filter_Push('encode' => 'blah') };
like $@, qr/^Encoding 'blah' is not available/, "push an illigal filter" ;
@@ -83,9 +93,9 @@ undef $db1;
# read the dbm file without the filter
my %h2 = () ;
-my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db2, "tied to SDBM_File";
+ok $db2, "tied to $db_file";
if (ord('A') == 193) { # EBCDIC.
VerifyData(\%h2,
diff --git a/lib/DBM_Filter/t/int32.t b/lib/DBM_Filter/t/int32.t
index 5cdadde057..96d4d9e8e1 100644
--- a/lib/DBM_Filter/t/int32.t
+++ b/lib/DBM_Filter/t/int32.t
@@ -8,16 +8,26 @@ require "dbm_filter_util.pl";
use Test::More tests => 22;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
unlink <Op_dbmx*>;
END { unlink <Op_dbmx*>; }
my %h1 = () ;
-my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db1, "tied to SDBM_File";
+ok $db1, "tied to $db_file";
# store before adding the filter
@@ -63,9 +73,9 @@ undef $db1;
# read the dbm file without the filter
my %h2 = () ;
-my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db2, "tied to SDBM_File";
+ok $db2, "tied to $db_file";
VerifyData(\%h2,
{
diff --git a/lib/DBM_Filter/t/null.t b/lib/DBM_Filter/t/null.t
index 2d1c22a8af..8846183bf8 100644
--- a/lib/DBM_Filter/t/null.t
+++ b/lib/DBM_Filter/t/null.t
@@ -8,16 +8,26 @@ require "dbm_filter_util.pl";
use Test::More tests => 26;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
unlink <Op_dbmx*>;
END { unlink <Op_dbmx*>; }
my %h1 = () ;
-my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db1, "tied to SDBM_File";
+ok $db1, "tied to $db_file";
# store before adding the filter
@@ -66,9 +76,9 @@ undef $db1;
# read the dbm file without the filter, check for null termination
my %h2 = () ;
-my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db2, "tied to SDBM_File";
+ok $db2, "tied to $db_file";
VerifyData(\%h2,
{
diff --git a/lib/DBM_Filter/t/utf8.t b/lib/DBM_Filter/t/utf8.t
index f884e04eea..0bc38f8603 100644
--- a/lib/DBM_Filter/t/utf8.t
+++ b/lib/DBM_Filter/t/utf8.t
@@ -19,7 +19,17 @@ require "dbm_filter_util.pl";
use Test::More tests => 20;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
BEGIN { use_ok('charnames', qw{greek})};
@@ -29,9 +39,9 @@ unlink <Op_dbmx*>;
END { unlink <Op_dbmx*>; }
my %h1 = () ;
-my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db1, "tied to SDBM_File";
+ok $db1, "tied to $db_file";
eval { $db1->Filter_Push('utf8') };
is $@, '', "push a 'utf8' filter" ;
@@ -65,9 +75,9 @@ undef $db1;
# read the dbm file without the filter
my %h2 = () ;
-my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
-ok $db2, "tied to SDBM_File";
+ok $db2, "tied to $db_file";
if (ord('A') == 193) { # EBCDIC.
VerifyData(\%h2,