Mercurial > hg > xemacs-beta
annotate tests/automated/database-tests.el @ 5936:574f0cded429 cygwin
try to replace all nnnL or nnnUL constants with EMACS_[U]INT
| author | Henry Thompson <ht@markup.co.uk> |
|---|---|
| date | Sun, 13 Dec 2015 13:22:58 +0000 |
| parents | 071b810ceb18 |
| children |
| rev | line source |
|---|---|
| 428 | 1 ;; Copyright (C) 1998 Free Software Foundation, Inc. |
| 2 | |
| 3 ;; Author: Martin Buchholz <martin@xemacs.org> | |
| 4 ;; Maintainer: Martin Buchholz <martin@xemacs.org> | |
| 5 ;; Created: 1998 | |
| 6 ;; Keywords: tests, database | |
| 7 | |
| 8 ;; This file is part of XEmacs. | |
| 9 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
10 ;; XEmacs is free software: you can redistribute it and/or modify it |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
11 ;; under the terms of the GNU General Public License as published by the |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
12 ;; Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
13 ;; option) any later version. |
| 428 | 14 |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
18 ;; for more details. |
| 428 | 19 |
| 20 ;; You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
| 428 | 22 |
| 23 ;;; Synched up with: Not in FSF. | |
| 24 | |
| 25 ;;; Commentary: | |
| 26 | |
| 27 ;;; Test database functionality | |
| 28 ;;; See test-harness.el | |
| 29 | |
| 30 (condition-case nil | |
| 31 (require 'test-harness) | |
| 32 (file-error | |
| 33 (when (and (boundp 'load-file-name) (stringp load-file-name)) | |
| 34 (push (file-name-directory load-file-name) load-path) | |
| 35 (require 'test-harness)))) | |
| 36 | |
|
5576
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
37 (labels ((delete-database-files (filename) |
|
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
38 (dolist (fn (list filename |
|
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
39 (concat filename ".db") |
|
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
40 (concat filename ".pag") |
|
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
41 (concat filename ".dir"))) |
|
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
42 (ignore-file-errors (delete-file fn)))) |
| 428 | 43 |
| 44 (test-database (db) | |
| 45 (Assert (databasep db)) | |
| 46 (put-database "key1" "val1" db) | |
|
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
47 (Assert (equal "val1" (get-database "key1" db))) |
| 428 | 48 (remove-database "key1" db) |
|
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
49 (Assert (equal nil (get-database "key1" db))) |
| 428 | 50 (close-database db) |
| 51 (Assert (not (database-live-p db))) | |
| 52 (Assert (databasep db)))) | |
| 53 | |
| 54 (let ((filename (expand-file-name "test-harness" (temp-directory)))) | |
| 55 | |
| 56 (dolist (db-type '(dbm berkeley-db)) | |
| 57 (when (featurep db-type) | |
| 58 (princ "\n") | |
| 59 (delete-database-files filename) | |
| 60 (test-database (open-database filename db-type)) | |
| 61 (delete-database-files filename))))) |
