diff options
| author | Stefan Kangas | 2021-04-09 13:44:44 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-04-09 13:44:44 +0200 |
| commit | 841dcfa7c351118aef402e58c3a204b671e1fe13 (patch) | |
| tree | 1c9fe6fe891a5820ba6139f0981c49b20e1ff427 /test | |
| parent | 612d73167688a9a9742478373933c4af5e3f8720 (diff) | |
| download | emacs-841dcfa7c351118aef402e58c3a204b671e1fe13.tar.gz emacs-841dcfa7c351118aef402e58c3a204b671e1fe13.zip | |
Use lexical-binding in loadhist.el and add tests
* lisp/loadhist.el: Use lexical-binding.
* test/lisp/loadhist-tests.el: New file.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/loadhist-tests.el | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/lisp/loadhist-tests.el b/test/lisp/loadhist-tests.el new file mode 100644 index 00000000000..b29796da42d --- /dev/null +++ b/test/lisp/loadhist-tests.el | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | ;;; loadhist-tests.el --- Tests for loadhist.el -*- lexical-binding:t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2021 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Stefan Kangas <stefankangas@gmail.com> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | |||
| 26 | (require 'ert) | ||
| 27 | (require 'loadhist) | ||
| 28 | |||
| 29 | (ert-deftest loadhist-tests-feature-symbols () | ||
| 30 | (should (equal (file-name-base (car (feature-symbols 'loadhist))) "loadhist")) | ||
| 31 | (should-not (feature-symbols 'non-existent-feature))) | ||
| 32 | |||
| 33 | (ert-deftest loadhist-tests-feature-file () | ||
| 34 | (should (equal (file-name-base (feature-file 'loadhist)) "loadhist")) | ||
| 35 | (should-error (feature-file 'non-existent-feature))) | ||
| 36 | |||
| 37 | (ert-deftest loadhist-tests-file-loadhist-lookup () | ||
| 38 | ;; This should probably be extended... | ||
| 39 | (should (listp (file-loadhist-lookup "loadhist")))) | ||
| 40 | |||
| 41 | (ert-deftest loadhist-tests-file-provides () | ||
| 42 | (should (eq (car (file-provides "loadhist")) 'loadhist))) | ||
| 43 | |||
| 44 | (ert-deftest loadhist-tests-file-requires () | ||
| 45 | (should-not (file-requires "loadhist"))) | ||
| 46 | |||
| 47 | (ert-deftest loadhist-tests-file-dependents () | ||
| 48 | (require 'dired-x) | ||
| 49 | (let ((deps (file-dependents "dired"))) | ||
| 50 | (should (member "dired-x" (mapcar #'file-name-base deps))))) | ||
| 51 | |||
| 52 | (ert-deftest loadhist-tests-unload-feature () | ||
| 53 | (require 'dired-x) | ||
| 54 | (should-error (unload-feature 'dired)) | ||
| 55 | (unload-feature 'dired-x)) | ||
| 56 | |||
| 57 | ;;; loadhist-tests.el ends here | ||