aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPhilipp Stephani2019-01-02 22:04:56 +0100
committerPhilipp Stephani2019-02-24 22:43:07 +0100
commit72ec233f2a1b8a6a9574e61588d0467caf41755c (patch)
tree725add4413feb9cb7789576294099096e63d3044 /test/src
parent5653b76d0bacf1edfc3d962c0bb991344cd80f6f (diff)
downloademacs-72ec233f2a1b8a6a9574e61588d0467caf41755c.tar.gz
emacs-72ec233f2a1b8a6a9574e61588d0467caf41755c.zip
Ignore pending_signals when checking for quits.
pending_signals is often set if no quit is pending. This results in bugs in module code if the module returns but no quit is actually pending. As a better alternative, add a new process_input environment function for Emacs 27. That function processes signals (like maybe_quit). * configure.ac: Add module snippet for Emacs 27. * src/module-env-27.h: New file. * src/emacs-module.h.in: Add process_input function to environment interface. * src/emacs-module.c (module_should_quit): Use QUITP macro to check whether the caller should quit. (module_process_input): New function. (initialize_environment): Use it. * src/eval.c: Remove obsolete comment. * test/data/emacs-module/mod-test.c (signal_wrong_type_argument) (signal_errno): New helper functions. (Fmod_test_sleep_until): New test module function. * test/src/emacs-module-tests.el (mod-test-sleep-until): New unit test. * doc/lispref/internals.texi (Module Misc): Document process_input.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/emacs-module-tests.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index e4593044ecd..e30980b5993 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -289,4 +289,24 @@ Return A + B"
289 (should (member '(provide . mod-test) entries)) 289 (should (member '(provide . mod-test) entries))
290 (should (member '(defun . mod-test-sum) entries)))) 290 (should (member '(defun . mod-test-sum) entries))))
291 291
292(ert-deftest mod-test-sleep-until ()
293 "Check that `mod-test-sleep-until' either returns normally or quits.
294Interactively, you can try hitting \\[keyboard-quit] to quit."
295 (dolist (arg '(nil t))
296 ;; Guard against some caller setting `inhibit-quit'.
297 (with-local-quit
298 (condition-case nil
299 (should (eq (with-local-quit
300 ;; Because `inhibit-quit' is nil here, the next
301 ;; form either quits or returns `finished'.
302 (mod-test-sleep-until
303 ;; Interactively, run for 5 seconds to give the
304 ;; user time to quit. In batch mode, run only
305 ;; briefly since the user can't quit.
306 (float-time (time-add nil (if noninteractive 0.1 5)))
307 ;; should_quit or process_input
308 arg))
309 'finished))
310 (quit)))))
311
292;;; emacs-module-tests.el ends here 312;;; emacs-module-tests.el ends here