test/emacs: provide macro test-log-error

Because of the way emacs reports errors, a test form can crash and not
change the main buffer. To work around this, capture both signalled
errors and any other messages.
This commit is contained in:
David Bremner 2021-08-29 12:23:27 -07:00
parent 7556bb7da2
commit 59d0d5a489

View file

@ -174,6 +174,18 @@ running, quit if it terminated."
" "))
tags-to-letters ""))))
;; Log any signalled error (and other messages) to MESSAGES
;; Log "COMPLETE" if forms complete without error.
(defmacro test-log-error (&rest body)
`(progn
(with-current-buffer "*Messages*"
(let ((inhibit-read-only t)) (erase-buffer)))
(condition-case err
(progn ,@body
(message "COMPLETE"))
(t (message "%s" err)))
(with-current-buffer "*Messages*" (test-output "MESSAGES"))))
;; For historical reasons, we hide deleted tags by default in the test
;; suite
(setq notmuch-tag-deleted-formats