Function: ert-describe-test
ert-describe-test is an autoloaded, interactive and byte-compiled
function defined in ert.el.gz.
Signature
(ert-describe-test TEST-OR-TEST-NAME)
Documentation
Display the documentation for TEST-OR-TEST-NAME (a symbol or ert-test).
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
;;;###autoload
(defun ert-describe-test (test-or-test-name)
"Display the documentation for TEST-OR-TEST-NAME (a symbol or ert-test)."
(interactive (list (ert-read-test-name-at-point "Describe test")))
(let (test-name
test-definition)
(cl-etypecase test-or-test-name
(symbol (setq test-name test-or-test-name
test-definition (ert-get-test test-or-test-name)))
(ert-test (setq test-name (ert-test-name test-or-test-name)
test-definition test-or-test-name)))
(help-setup-xref (list #'ert-describe-test test-or-test-name)
(called-interactively-p 'interactive))
(save-excursion
(with-help-window (help-buffer)
(with-current-buffer (help-buffer)
(insert (if test-name (format "%S" test-name) "<anonymous test>"))
(insert " is a test")
(let ((file-name (and test-name
(symbol-file test-name 'ert--test))))
(when file-name
(insert (format-message " defined in `%s'"
(file-name-nondirectory file-name)))
(save-excursion
(re-search-backward (substitute-command-keys "`\\([^`']+\\)'"))
(help-xref-button 1 'ert--test-name-button
test-name file-name)))
(insert ".")
(fill-region-as-paragraph (point-min) (point))
(insert "\n\n")
(unless (and (ert-test-boundp test-name)
(eql (ert-get-test test-name) test-definition))
(let ((begin (point)))
(insert "Note: This test has been redefined or deleted, "
"this documentation refers to an old definition.")
(fill-region-as-paragraph begin (point)))
(insert "\n\n"))
(insert (substitute-command-keys
(or (ert-test-documentation test-definition)
"It is not documented."))
"\n")
;; For describe-symbol-backends.
(buffer-string)))))))