[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-simulated-input 47aa40dbe1 021/134: Handle the case w
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/with-simulated-input 47aa40dbe1 021/134: Handle the case where SECS exactly equals a timer's time |
Date: |
Mon, 10 Jan 2022 23:00:00 -0500 (EST) |
branch: elpa/with-simulated-input
commit 47aa40dbe115e578f0ed3b01c45a770371589e17
Author: Ryan C. Thompson <rct@thompsonclan.org>
Commit: Ryan C. Thompson <rct@thompsonclan.org>
Handle the case where SECS exactly equals a timer's time
To avoid floating point issues, we just unconditionally add 0.0001 to
SECS.
---
tests/test-with-simulated-input.el | 2 +-
with-simulated-input.el | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/test-with-simulated-input.el
b/tests/test-with-simulated-input.el
index 273ccffc3d..f533759a8b 100644
--- a/tests/test-with-simulated-input.el
+++ b/tests/test-with-simulated-input.el
@@ -107,7 +107,7 @@
(spy-calls-reset 'idle-canary))
(it "should run idle timers"
(run-with-idle-timer 500 nil 'idle-canary)
- (wsi-simulate-idle-time 501)
+ (wsi-simulate-idle-time 500)
(expect 'idle-canary :to-have-been-called))
(it "should not run idle times with longer times"
(run-with-idle-timer 500 nil 'set 'idle-canary)
diff --git a/with-simulated-input.el b/with-simulated-input.el
index e4787cb936..5eb8bdf8c8 100644
--- a/with-simulated-input.el
+++ b/with-simulated-input.el
@@ -247,6 +247,9 @@ though they would run during real idle time."
(setq secs
(cl-loop for timer in timer-idle-list
maximize (float-time (timer--time timer)))))
+ ;; Add a small fudge factor to deal with SECS being exactly equal to
+ ;; a timer's time, to avoid floating point issues.
+ (setq secs (+ secs 0.0001))
(cl-loop
with already-run-timers = nil
with stop-time = (seconds-to-time secs)
@@ -263,7 +266,7 @@ though they would run during real idle time."
if (time-less-p wsi-simulated-idle-time
(timer--time next-timer))
do (setq wsi-simulated-idle-time
- (timer--time next-timer))
+ (timer--time next-timer))
when actually-wait
do (sleep-for (float-time (time-subtract wsi-simulated-idle-time
previous-idle-time)))
- [nongnu] elpa/with-simulated-input 1006e93000 125/134: Add more tests to improve coverage, (continued)
- [nongnu] elpa/with-simulated-input 1006e93000 125/134: Add more tests to improve coverage, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9c160b2d81 106/134: Add warnings for quoted list KEYS and nil/constant BODY, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4eedb0eee8 126/134: Use an alternate method to disable eager macro-expansion for testing, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9d082a372a 113/134: Be more selective about which file changes trigger a CI run, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 681397b90d 130/134: Also test variables containing characters, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9ecf7c3f84 107/134: Improve code for detecting warnings in tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input ddd7bd71b1 011/134: Add "wsi-simulate-idle-time" and tests for it, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 662055c0a5 029/134: Handle non-lexical contexts as well as lexical, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 7f37451dcf 019/134: Use closures instead of quoted expressions, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input e7e8829eee 020/134: Make SECS arg to wsi-simulated-idle-time optional, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 47aa40dbe1 021/134: Handle the case where SECS exactly equals a timer's time,
ELPA Syncer <=
- [nongnu] elpa/with-simulated-input 5ce98adda7 022/134: Add test for SECS = nil and for repeated idle simulations, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input e860a39bba 024/134: Version 2.1, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input c57ba13c17 043/134: Disable Travis testing emacs snapshot because it hangs, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9fc83ac95d 047/134: Put spies in before-each form, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 2917358875 054/134: Minor CI tweaks, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 7bbe0ff680 056/134: Make sure buttercup and undercover are loadable in "eldev emacs", ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 311c142650 059/134: Add comments explaining why tests are run twice, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 09d6f80ddc 065/134: Add an `edebug' spec, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 14f3d86cb3 071/134: Fix tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 02b5d2c77f 072/134: Fix checkdoc warnings, ELPA Syncer, 2022/01/10