summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPaul Marquess <pmarquess@bfsec.bt.co.uk>1997-04-30 21:45:09 +0100
committerChip Salzenberg <chip@atlantic.net>1997-05-01 00:00:00 +1200
commit05475680fbb0187887aec733f8c78c90733ace24 (patch)
treeb67c7a88eb15885cc2bade6bf49eb2b5e70f7a73 /t
parent6b8afdafd43a19a5a652c59255c9895c9bcbe27b (diff)
downloadperl-05475680fbb0187887aec733f8c78c90733ace24.tar.gz
Refresh DB_File to 1.14
Something for _99. Made it illegal to tie an associative array to a RECNO database and an ordinary array to a HASH or BTREE database. p5p-msgid: 9704302045.AA05484@claudius.bfsec.bt.co.uk
Diffstat (limited to 't')
-rwxr-xr-xt/lib/db-btree.t12
-rwxr-xr-xt/lib/db-hash.t12
-rwxr-xr-xt/lib/db-recno.t12
3 files changed, 33 insertions, 3 deletions
diff --git a/t/lib/db-btree.t b/t/lib/db-btree.t
index 897548585b..c90c9d7d98 100755
--- a/t/lib/db-btree.t
+++ b/t/lib/db-btree.t
@@ -12,7 +12,7 @@ BEGIN {
use DB_File;
use Fcntl;
-print "1..91\n";
+print "1..92\n";
sub ok
{
@@ -503,4 +503,14 @@ ok(91, $i == 0);
untie %h ;
unlink $Dfile1 ;
+{
+ # check that attempting to tie an array to a DB_BTREE will fail
+
+ my $filename = "xyz" ;
+ my @x ;
+ eval { tie @x, 'DB_File', $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE ; } ;
+ ok(92, $@ =~ /^DB_File can only tie an associative array to a DB_BTREE database/) ;
+ unlink $filename ;
+}
+
exit ;
diff --git a/t/lib/db-hash.t b/t/lib/db-hash.t
index 9765e2ed86..471ee0283b 100755
--- a/t/lib/db-hash.t
+++ b/t/lib/db-hash.t
@@ -12,7 +12,7 @@ BEGIN {
use DB_File;
use Fcntl;
-print "1..51\n";
+print "1..52\n";
sub ok
{
@@ -310,4 +310,14 @@ untie %h ;
ok(51, $::count >0) ;
}
+{
+ # check that attempting to tie an array to a DB_HASH will fail
+
+ my $filename = "xyz" ;
+ my @x ;
+ eval { tie @x, 'DB_File', $filename, O_RDWR|O_CREAT, 0640, $DB_HASH ; } ;
+ ok(52, $@ =~ /^DB_File can only tie an associative array to a DB_HASH database/) ;
+ unlink $filename ;
+}
+
exit ;
diff --git a/t/lib/db-recno.t b/t/lib/db-recno.t
index 5df5af1808..338edd0db5 100755
--- a/t/lib/db-recno.t
+++ b/t/lib/db-recno.t
@@ -41,7 +41,7 @@ sub bad_one
EOM
}
-print "1..55\n";
+print "1..56\n";
my $Dfile = "recno.tmp";
unlink $Dfile ;
@@ -270,4 +270,14 @@ unlink $Dfile;
ok(55, $ok) ;
}
+{
+ # check that attempting to tie an associative array to a DB_RECNO will fail
+
+ my $filename = "xyz" ;
+ my %x ;
+ eval { tie %x, 'DB_File', $filename, O_RDWR|O_CREAT, 0640, $DB_RECNO ; } ;
+ ok(56, $@ =~ /^DB_File can only tie an array to a DB_RECNO database/) ;
+ unlink $filename ;
+}
+
exit ;