summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-11-25 11:13:06 -0800
committerJim Porter <jporterbugs@gmail.com>2022-11-26 13:40:33 -0800
commit14d54212ea46dbd8c950c9852318597e0e47908d (patch)
tree59dc3ec997725f0887c077b9d6b4463ea9492741 /lisp/emacs-lisp
parenteb713a8fccc7f0512cfdbd5c520d4c856746a968 (diff)
downloademacs-14d54212ea46dbd8c950c9852318597e0e47908d.tar.gz
emacs-14d54212ea46dbd8c950c9852318597e0e47908d.tar.bz2
emacs-14d54212ea46dbd8c950c9852318597e0e47908d.zip
Improve robustness of server.el tests
* lisp/emacs-lisp/ert.el (ert--insert-infos): Allow 'message' to be a function that is called when inserting the info. (ert-info): Update docstring to describe using a function for MESSAGE-FORM. * lisp/server.el (server-start): Log when the server is starting. * test/lisp/server-tests.el (server-tests/can-create-frames-p): New constant. Use it to skip tests that need to create frames. (server-tests/start-emacsclient): Rename to... (server-tests/start-client): ... this, and set the process's buffer. (server-tests/with-server): Put the server file in a temporary directory so we don't conflict with real Emacs servers. (server-tests/with-client): New macro... (server-tests/server-start/stop-prompt-with-client) (server-tests/emacsclient/server-edit) (server-tests/emacsclient/create-frame) (server-tests/emacsclient/create-frame): ... use it. (server-tests/server-start/stop-prompt-with-client): Simplify.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/ert.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index c25ade22d6f..67cbe62538c 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -673,8 +673,11 @@ Bound dynamically. This is a list of (PREFIX . MESSAGE) pairs.")
To be used within ERT tests. MESSAGE-FORM should evaluate to a
string that will be displayed together with the test result if
-the test fails. PREFIX-FORM should evaluate to a string as well
-and is displayed in front of the value of MESSAGE-FORM."
+the test fails. MESSAGE-FORM can also evaluate to a function; in
+this case, it will be called when displaying the info.
+
+PREFIX-FORM should evaluate to a string as well and is displayed
+in front of the value of MESSAGE-FORM."
(declare (debug ((form &rest [sexp form]) body))
(indent 1))
`(let ((ert--infos (cons (cons ,prefix-form ,message-form) ert--infos)))
@@ -1352,6 +1355,8 @@ RESULT must be an `ert-test-result-with-condition'."
(end nil))
(unwind-protect
(progn
+ (when (functionp message)
+ (setq message (funcall message)))
(insert message "\n")
(setq end (point-marker))
(goto-char begin)