Fix ERT / find-function type integration typos

* lisp/emacs-lisp/ert.el (ert-test-location, ert-describe-test):
Correctly type the test object as 'ert--test'.
* lisp/emacs-lisp/find-func.el (find-ert-deftest-regexp): Remove this
duplicate, broken customization.
This commit is contained in:
Stephen Gildea 2025-01-22 19:22:24 -08:00
parent aa6d2a396a
commit 90b4c1b6f2
2 changed files with 8 additions and 15 deletions

View file

@ -1355,7 +1355,7 @@ RESULT must be an `ert-test-result-with-condition'."
(when-let* ((loc
(ignore-errors
(find-function-search-for-symbol
(ert-test-name test) 'ert-deftest (ert-test-file-name test)))))
(ert-test-name test) 'ert--test (ert-test-file-name test)))))
(let* ((buffer (car loc))
(point (cdr loc))
(file (file-relative-name (buffer-file-name buffer)))
@ -2467,7 +2467,9 @@ To be used in the ERT results buffer."
(defun ert--test-name-button-action (button)
"Find the definition of the test BUTTON belongs to, in another window."
(let ((name (button-get button 'ert-test-name)))
;; work with either ert-insert-test-name-button or help-xref-button
(let ((name (or (button-get button 'ert-test-name)
(car (button-get button 'help-args)))))
(ert-find-test-other-window name)))
(defun ert--ewoc-position (ewoc node)
@ -2814,7 +2816,8 @@ To be used in the ERT results buffer."
(file-name-nondirectory file-name)))
(save-excursion
(re-search-backward (substitute-command-keys "`\\([^`']+\\)'"))
(help-xref-button 1 'help-function-def test-name file-name)))
(help-xref-button 1 'ert--test-name-button
test-name file-name)))
(insert ".")
(fill-region-as-paragraph (point-min) (point))
(insert "\n\n")
@ -2855,7 +2858,7 @@ To be used in the ERT results buffer."
(defun ert--unload-function ()
"Unload function to undo the side-effects of loading ert.el."
(ert--remove-from-list 'find-function-regexp-alist 'ert-deftest :key #'car)
(ert--remove-from-list 'find-function-regexp-alist 'ert--test :key #'car)
(ert--remove-from-list 'minor-mode-alist 'ert--current-run-stats :key #'car)
(ert--remove-from-list 'emacs-lisp-mode-hook
'ert--activate-font-lock-keywords)

View file

@ -123,15 +123,6 @@ should insert the feature name."
:group 'xref
:version "25.1")
(defcustom find-ert-deftest-regexp
"(ert-deftest +'%s"
"The regexp used to search for an `ert-deftest' definition.
Note it must contain a `%s' at the place where `format'
should insert the feature name."
:type 'regexp
:group 'xref
:version "29.1")
(defun find-function--defface (symbol)
(catch 'found
(while (re-search-forward (format find-face-regexp symbol) nil t)
@ -145,8 +136,7 @@ should insert the feature name."
(defvar . find-variable-regexp)
(defface . find-function--defface)
(feature . find-feature-regexp)
(defalias . find-alias-regexp)
(ert-deftest . find-ert-deftest-regexp))
(defalias . find-alias-regexp))
"Alist mapping definition types into regexp variables.
Each regexp variable's value should actually be a format string
to be used to substitute the desired symbol name into the regexp.