[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need message-fn arg back in ert-run-tests-interactively
From: |
Stefan Kangas |
Subject: |
Re: Need message-fn arg back in ert-run-tests-interactively |
Date: |
Tue, 5 Sep 2023 15:43:57 -0700 |
Robert Weiner <rsw@gnu.org> writes:
> In ert.el of Emacs 27.1, we have a simple ability to override the 'message'
> function when running ert tests interactively by setting the message-fn
> argument here:
>
> ;; Should OUTPUT-BUFFER-NAME and MESSAGE-FN really be arguments here?
> ;; They are needed only for our automated self-tests at the moment.
> ;; Or should there be some other mechanism?
> ;;;###autoload
> (defun ert-run-tests-interactively (selector
> &optional output-buffer-name message-fn)
>
> But in recent Emacs versions this function takes only the selector
> argument, with no clear way of how to override messaging behavior so that a
> message from a test case (rather than ert itself) can remain in the
> minibuffer after a test case finishes:
>
> (defun ert-run-tests-interactively (selector)
> "Run the tests specified by SELECTOR and display the results in a buffer.
>
> SELECTOR works as described in `ert-select-tests'."
>
> This would be very useful behavior to have back. Is there any simple way
> to do it now or can you add it back in?
You can use something like this:
(cl-letf (((symbol-function 'message)
(lambda (format-string &rest args)
...)))
(ert-run-tests-interactively t))
This should work on both new and old versions of Emacs.
- Re: Need message-fn arg back in ert-run-tests-interactively,
Stefan Kangas <=