diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-07-24 15:58:30 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-07-24 15:58:30 -0400 |
commit | 69fb12a66b3d6b9bfb55d8bcd58bec2a8e7ca55b (patch) | |
tree | 7608f9b5cc190eee0670647712080937d4bae602 /lisp/emacs-lisp/ert.el | |
parent | f07b12c1d036e50daa25b3a18b13686be6628c4d (diff) | |
download | emacs-69fb12a66b3d6b9bfb55d8bcd58bec2a8e7ca55b.tar.gz |
(loadhist-unload-element): Move ERT and cl-generic methods
* lisp/loadhist.el (loadhist-unload-element): Don't define cl-generic
and ert methods here.
(loadhist-unload-element) <(head define-type)>: Remove unused var `slots'.
* lisp/emacs-lisp/cl-generic.el (loadhist-unload-element): Define
unload method for cl-defmethod.
(cl-generic-ensure-function): Remove redundant `defalias'.
* lisp/emacs-lisp/ert.el (ert-set-test): Move the current-load-list
setting here...
(ert-deftest): ...from here.
(loadhist-unload-element): Define unload method for ert-deftest.
Diffstat (limited to 'lisp/emacs-lisp/ert.el')
-rw-r--r-- | lisp/emacs-lisp/ert.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index cee225cc8e0..5c88b070f65 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -136,8 +136,15 @@ Emacs bug 6581 at URL `http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6581'." ;; ert-test objects. It designates an anonymous test. (error "Attempt to define a test named nil")) (put symbol 'ert--test definition) + ;; Register in load-history, so `symbol-file' can find us, and so + ;; unload-feature can unload our tests. + (cl-pushnew `(ert-deftest . ,symbol) current-load-list :test #'equal) definition) +(cl-defmethod loadhist-unload-element ((x (head ert-deftest))) + (let ((name (cdr x))) + (put name 'ert--test nil))) + (defun ert-make-test-unbound (symbol) "Make SYMBOL name no test. Return SYMBOL." (cl-remprop symbol 'ert--test) @@ -214,12 +221,6 @@ description of valid values for RESULT-TYPE. ,@(when tags-supplied-p `(:tags ,tags)) :body (lambda () ,@body))) - ;; This hack allows `symbol-file' to associate `ert-deftest' - ;; forms with files, and therefore enables `find-function' to - ;; work with tests. However, it leads to warnings in - ;; `unload-feature', which doesn't know how to undefine tests - ;; and has no mechanism for extension. - (push '(ert-deftest . ,name) current-load-list) ',name)))) ;; We use these `put' forms in addition to the (declare (indent)) in |