emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#25158: closed ([PATCH] A better way for test code


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#25158: closed ([PATCH] A better way for test code to access messages)
Date: Sat, 04 Feb 2017 11:41:02 +0000

Your message dated Sat, 04 Feb 2017 13:39:53 +0200
with message-id <address@hidden>
and subject line Re: bug#25158: [PATCH] A better way for test code to access 
messages
has caused the debbugs.gnu.org bug report #25158,
regarding [PATCH] A better way for test code to access messages
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
25158: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25158
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] A better way for test code to access messages Date: Sat, 10 Dec 2016 09:29:05 -0800
Here is a quote from Bug#24939's discussion, regarding the technique
used by autorevert-tests.el, filenotify-tests.el and the proposed
kmacro-tests.el to collect messages issued during part of a test by
temporarily narrowing *Messages*:

Eli Zaretskii <address@hidden> writes:

> I don't like this implementation.  First, playing restriction games
> with *Messages* is inherently unsafe, because that buffer is treated
> specially by the code which puts messages there.  Second, this assumes
> *Messages* will have each message verbatim, which is false, because
> repeated messages aren't inserted.  And finally, some code can disable
> message logging or use some mechanism for displaying echo-area
> messages that bypasses *Messages*, in which case this macro will not
> catch the message.
>
> So I'd suggest instead to override or advice 'message', so you could
> get your hands on the messages more reliably.  It is possible we
> should have a more thorough infrastructure for collecting echo-area
> messages, which probably means parts of it should be implemented in C,
> but that's a separate project.
>

The attached patch adds a new macro called ert-with-message-capture to
ert-x.el which temporarily adds advice to 'message' to collect messages.
I've also modified autorevert-tests.el and filenotify-tests.el to use
the new macro. If or when the more thorough infrastructure is
implemented, that could replace the use of advice in this macro but the
tests which use it should not have to change.

Michael, in modifying autorevert-tests.el, at the start of
auto-revert-test02-auto-revert-deleted-file, *Messages* was narrowed,
and then narrowed again before the call to auto-revert--wait-for-revert,
so it looked safe to delete the first narrowing instead of replacing it
with ert-with-message-capture. Let me know if I've missed something
there.

Attachment: 0001-Add-ert-with-message-capture.patch
Description: Text document


--- End Message ---
--- Begin Message --- Subject: Re: bug#25158: [PATCH] A better way for test code to access messages Date: Sat, 04 Feb 2017 13:39:53 +0200
> Cc: Eli Zaretskii <address@hidden>, Michael Albinus <address@hidden>
> From: Gemini Lasswell <address@hidden>
> Date: Sat, 10 Dec 2016 09:29:05 -0800
> 
> Here is a quote from Bug#24939's discussion, regarding the technique
> used by autorevert-tests.el, filenotify-tests.el and the proposed
> kmacro-tests.el to collect messages issued during part of a test by
> temporarily narrowing *Messages*:
> 
> Eli Zaretskii <address@hidden> writes:
> 
> > I don't like this implementation.  First, playing restriction games
> > with *Messages* is inherently unsafe, because that buffer is treated
> > specially by the code which puts messages there.  Second, this assumes
> > *Messages* will have each message verbatim, which is false, because
> > repeated messages aren't inserted.  And finally, some code can disable
> > message logging or use some mechanism for displaying echo-area
> > messages that bypasses *Messages*, in which case this macro will not
> > catch the message.
> >
> > So I'd suggest instead to override or advice 'message', so you could
> > get your hands on the messages more reliably.  It is possible we
> > should have a more thorough infrastructure for collecting echo-area
> > messages, which probably means parts of it should be implemented in C,
> > but that's a separate project.
> >
> 
> The attached patch adds a new macro called ert-with-message-capture to
> ert-x.el which temporarily adds advice to 'message' to collect messages.
> I've also modified autorevert-tests.el and filenotify-tests.el to use
> the new macro. If or when the more thorough infrastructure is
> implemented, that could replace the use of advice in this macro but the
> tests which use it should not have to change.
> 
> Michael, in modifying autorevert-tests.el, at the start of
> auto-revert-test02-auto-revert-deleted-file, *Messages* was narrowed,
> and then narrowed again before the call to auto-revert--wait-for-revert,
> so it looked safe to delete the first narrowing instead of replacing it
> with ert-with-message-capture. Let me know if I've missed something
> there.

Making these changes didn't introduce any regressions in the relevant
tests, so I pushed them.

Gemini, please consider documenting the new macro in the ERT manual
and in NEWS.

Thanks.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]