summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/ert-x.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2020-09-14 16:04:22 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2020-09-14 16:04:22 -0400
commite408f2fab24ea81f74d9b84dc83ee67d562846dc (patch)
tree7f194f891e3e97f8d5861aab9f943c04b3b1664b /lisp/emacs-lisp/ert-x.el
parent15d2f6af000625640b3c47d2aeec3114ac1ac544 (diff)
downloademacs-e408f2fab24ea81f74d9b84dc83ee67d562846dc.tar.gz
emacs-e408f2fab24ea81f74d9b84dc83ee67d562846dc.tar.bz2
emacs-e408f2fab24ea81f74d9b84dc83ee67d562846dc.zip
* test/lisp/emacs-lisp/find-func-tests.el: New file (for bug#43393)
* lisp/emacs-lisp/ert-x.el (ert-simulate-keys): New macro. * test/lisp/international/mule-tests.el (mule-cmds--test-universal-coding-system-argument): Use it and enable the test also in batch mode.
Diffstat (limited to 'lisp/emacs-lisp/ert-x.el')
-rw-r--r--lisp/emacs-lisp/ert-x.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index 622f5654b25..6569b8ccc87 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -177,6 +177,18 @@ test for `called-interactively' in the command will fail."
(cl-assert (not unread-command-events) t)
return-value))
+(defmacro ert-simulate-keys (keys &rest body)
+ "Execute BODY with KEYS as pseudo-interactive input."
+ (declare (debug t) (indent 1))
+ `(let ((unread-command-events
+ ;; Add some C-g to try and make sure we still exit
+ ;; in case something goes wrong.
+ (append ,keys '(?\C-g ?\C-g ?\C-g)))
+ ;; Tell `read-from-minibuffer' not to read from stdin when in
+ ;; batch mode.
+ (executing-kbd-macro t))
+ ,@body))
+
(defun ert-run-idle-timers ()
"Run all idle timers (from `timer-idle-list')."
(dolist (timer (copy-sequence timer-idle-list))