1 ;; Copyright (C) 1998 Free Software Foundation, Inc.
3 ;; Author: Martin Buchholz <martin@xemacs.org>
4 ;; Maintainer: Martin Buchholz <martin@xemacs.org>
6 ;; Keywords: tests, database
8 ;; This file is part of XEmacs.
10 ;; XEmacs is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; XEmacs is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 ;;; Synched up with: Not in FSF.
29 ;;; Test database functionality
30 ;;; See test-harness.el
33 (require 'test-harness)
35 (when (and (boundp 'load-file-name) (stringp load-file-name))
36 (push (file-name-directory load-file-name) load-path)
37 (require 'test-harness))))
39 (flet ((delete-database-files (filename)
40 (dolist (fn (list filename (concat filename ".db")))
41 (ignore-file-errors (delete-file fn))))
44 (Assert (databasep db))
45 (put-database "key1" "val1" db)
46 (Assert (equal "val1" (get-database "key1" db)))
47 (remove-database "key1" db)
48 (Assert (equal nil (get-database "key1" db)))
50 (Assert (not (database-live-p db)))
51 (Assert (databasep db))))
53 (let ((filename (expand-file-name "test-harness" (temp-directory))))
55 (dolist (db-type '(dbm berkeley-db))
56 (when (featurep db-type)
58 (delete-database-files filename)
59 (test-database (open-database filename db-type))
60 (delete-database-files filename)))))