diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-04-09 13:44:44 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-04-09 13:44:44 +0200 |
commit | 841dcfa7c351118aef402e58c3a204b671e1fe13 (patch) | |
tree | 1c9fe6fe891a5820ba6139f0981c49b20e1ff427 | |
parent | 612d73167688a9a9742478373933c4af5e3f8720 (diff) | |
download | emacs-841dcfa7c351118aef402e58c3a204b671e1fe13.tar.gz |
Use lexical-binding in loadhist.el and add tests
* lisp/loadhist.el: Use lexical-binding.
* test/lisp/loadhist-tests.el: New file.
-rw-r--r-- | lisp/loadhist.el | 2 | ||||
-rw-r--r-- | test/lisp/loadhist-tests.el | 57 |
2 files changed, 58 insertions, 1 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 59c002d3078..0b12bdad058 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -1,4 +1,4 @@ -;;; loadhist.el --- lisp functions for working with feature groups +;;; loadhist.el --- lisp functions for working with feature groups -*- lexical-binding: t -*- ;; Copyright (C) 1995, 1998, 2000-2021 Free Software Foundation, Inc. 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 @@ +;;; loadhist-tests.el --- Tests for loadhist.el -*- lexical-binding:t -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Stefan Kangas <stefankangas@gmail.com> + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'loadhist) + +(ert-deftest loadhist-tests-feature-symbols () + (should (equal (file-name-base (car (feature-symbols 'loadhist))) "loadhist")) + (should-not (feature-symbols 'non-existent-feature))) + +(ert-deftest loadhist-tests-feature-file () + (should (equal (file-name-base (feature-file 'loadhist)) "loadhist")) + (should-error (feature-file 'non-existent-feature))) + +(ert-deftest loadhist-tests-file-loadhist-lookup () + ;; This should probably be extended... + (should (listp (file-loadhist-lookup "loadhist")))) + +(ert-deftest loadhist-tests-file-provides () + (should (eq (car (file-provides "loadhist")) 'loadhist))) + +(ert-deftest loadhist-tests-file-requires () + (should-not (file-requires "loadhist"))) + +(ert-deftest loadhist-tests-file-dependents () + (require 'dired-x) + (let ((deps (file-dependents "dired"))) + (should (member "dired-x" (mapcar #'file-name-base deps))))) + +(ert-deftest loadhist-tests-unload-feature () + (require 'dired-x) + (should-error (unload-feature 'dired)) + (unload-feature 'dired-x)) + +;;; loadhist-tests.el ends here |