From e408f2fab24ea81f74d9b84dc83ee67d562846dc Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 14 Sep 2020 16:04:22 -0400 Subject: * 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. --- lisp/emacs-lisp/ert-x.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lisp/emacs-lisp/ert-x.el') 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)) -- cgit v1.2.3