diff options
| author | Barry O'Reilly | 2013-10-18 00:27:34 -0400 |
|---|---|---|
| committer | Barry O'Reilly | 2013-10-18 00:27:34 -0400 |
| commit | ef566920352fea106b283bcfeba1e61f3969f541 (patch) | |
| tree | 36744e23acb0c8efc1be773e79f90d11bf06bc39 /test | |
| parent | 29df8a0b10233b25319c1710753a08f2ffd5d310 (diff) | |
| download | emacs-ef566920352fea106b283bcfeba1e61f3969f541.tar.gz emacs-ef566920352fea106b283bcfeba1e61f3969f541.zip | |
Don't run timers in input-pending-p. Its new check-timers param
provides the prior behavior..
* src/keyboard.c (Finput_pending_p): Accept optional check-timers
param.
* lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave
as before.
* test/automated/timer-tests.el: New file. Tests that (sit-for 0)
allows another timer to run.
Fixes: debbugs:15045
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/timer-tests.el | 38 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index bf5a4275483..9a8a61eb062 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-17 Barry O'Reilly <gundaetiapo@gmail.com> | ||
| 2 | |||
| 3 | * test/automated/timer-tests.el: New file. Tests that (sit-for 0) | ||
| 4 | allows another timer to run. | ||
| 5 | |||
| 1 | 2013-10-14 Dmitry Gutov <dgutov@yandex.ru> | 6 | 2013-10-14 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 7 | ||
| 3 | * indent/ruby.rb: More examples for bug#15594, both failing and | 8 | * indent/ruby.rb: More examples for bug#15594, both failing and |
diff --git a/test/automated/timer-tests.el b/test/automated/timer-tests.el new file mode 100644 index 00000000000..71a9b968f9c --- /dev/null +++ b/test/automated/timer-tests.el | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | ;;; timer-tests.el --- tests for timers -*- lexical-binding:t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2013 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; This program is free software: you can redistribute it and/or | ||
| 8 | ;; modify it under the terms of the GNU General Public License as | ||
| 9 | ;; published by the Free Software Foundation, either version 3 of the | ||
| 10 | ;; License, or (at your option) any later version. | ||
| 11 | ;; | ||
| 12 | ;; This program is distributed in the hope that it will be useful, but | ||
| 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | ;; General Public License for more details. | ||
| 16 | ;; | ||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with this program. If not, see `http://www.gnu.org/licenses/'. | ||
| 19 | |||
| 20 | ;;; Commentary: | ||
| 21 | |||
| 22 | ;;; Code: | ||
| 23 | |||
| 24 | (ert-deftest timer-tests-sit-for () | ||
| 25 | (let ((timer-ran nil) | ||
| 26 | ;; Want sit-for behavior when interactive | ||
| 27 | (noninteractive nil)) | ||
| 28 | (run-at-time '(0 0 0 0) | ||
| 29 | nil | ||
| 30 | (lambda () (setq timer-ran t))) | ||
| 31 | ;; The test assumes run-at-time didn't take the liberty of firing | ||
| 32 | ;; the timer, so assert the test's assumption | ||
| 33 | (should (not timer-ran)) | ||
| 34 | (sit-for 0 t) | ||
| 35 | (should timer-ran))) | ||
| 36 | |||
| 37 | ;;; timer-tests.el ends here | ||
| 38 | |||