From: Stefan Kangas <stefankangas@gmail.com>
To: rswgnu@gmail.com, emacs-devel <emacs-devel@gnu.org>
Cc: Lidell Mats <matsl@gnu.org>
Subject: Re: Need message-fn arg back in ert-run-tests-interactively
Date: Tue, 5 Sep 2023 15:43:57 -0700 [thread overview]
Message-ID: <CADwFkmmL6+0ESKE0xej04w80gB-9HDd9EsBrU4EEcXNxs86pEw@mail.gmail.com> (raw)
In-Reply-To: <CA+OMD9iLUsiujjfNPf_WE9Dp5_rBtdm1dpWVkVdSzEbO2Mc-KQ@mail.gmail.com>
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.
next prev parent reply other threads:[~2023-09-05 22:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-09 15:49 Need message-fn arg back in ert-run-tests-interactively Robert Weiner
2023-07-11 6:18 ` Robert Weiner
2023-09-05 22:43 ` Stefan Kangas [this message]
2023-09-07 1:21 ` Richard Stallman
2023-09-07 6:22 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADwFkmmL6+0ESKE0xej04w80gB-9HDd9EsBrU4EEcXNxs86pEw@mail.gmail.com \
--to=stefankangas@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=matsl@gnu.org \
--cc=rswgnu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).