emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 841dcfa: Use lexical-binding in loadhist.el and add tests


From: Stefan Kangas
Subject: master 841dcfa: Use lexical-binding in loadhist.el and add tests
Date: Fri, 9 Apr 2021 08:33:13 -0400 (EDT)

branch: master
commit 841dcfa7c351118aef402e58c3a204b671e1fe13
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Use lexical-binding in loadhist.el and add tests
    
    * lisp/loadhist.el: Use lexical-binding.
    * test/lisp/loadhist-tests.el: New file.
---
 lisp/loadhist.el            |  2 +-
 test/lisp/loadhist-tests.el | 57 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 59c002d..0b12bda 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 0000000..b29796d
--- /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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]