[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-simulated-input 14f3d86cb3 071/134: Fix tests
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/with-simulated-input 14f3d86cb3 071/134: Fix tests |
Date: |
Mon, 10 Jan 2022 23:00:06 -0500 (EST) |
branch: elpa/with-simulated-input
commit 14f3d86cb3e76ff017a9c84b07352440d3956c89
Author: Nikita Bloshchanevich <nikblos@outlook.com>
Commit: Nikita Bloshchanevich <nikblos@outlook.com>
Fix tests
Add a Caskfile.
Add the old `switch-to-buffer' workaround.
Add UNBOUND-KEY to the end of the `kbd' list, so that the "End of input"
error
can be thrown.
Refactor: Move the `error' above into a lambda instead of checking ACTIONS
every
time in the next-form keybinding.
---
Cask | 7 +++++++
with-simulated-input.el | 22 ++++++++++++----------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/Cask b/Cask
new file mode 100644
index 0000000000..f1dc54d301
--- /dev/null
+++ b/Cask
@@ -0,0 +1,7 @@
+(source gnu)
+(source melpa)
+
+(package-file "with-simulated-input.el")
+
+(development
+ (depends-on "buttercup"))
diff --git a/with-simulated-input.el b/with-simulated-input.el
index 21f671d57b..8af260d445 100644
--- a/with-simulated-input.el
+++ b/with-simulated-input.el
@@ -108,9 +108,13 @@ the body form as a function."
;; Ensure we don't interfere with any outside catching.
(result-sym (make-symbol "result"))
(error-sym (make-symbol "error"))
- (actions (cons (lambda ()
- (throw result-sym (funcall main)))
- (cl-remove-if-not #'functionp keys)))
+ (orig-buf (current-buffer))
+ (actions (nconc (list (lambda ()
+ (switch-to-buffer orig-buf)
+ (throw result-sym (funcall main))))
+ (cl-remove-if-not #'functionp keys)
+ (list (lambda ()
+ (error "Reached end of simulated input while
simulating body")))))
(overriding-terminal-local-map
(if overriding-terminal-local-map
(copy-keymap overriding-terminal-local-map)
@@ -119,10 +123,7 @@ the body form as a function."
(lambda ()
(interactive)
(condition-case data
- (progn
- (unless actions
- (error "Reached end of simulated input while simulating body"))
- (funcall (pop actions)))
+ (funcall (pop actions))
(t (throw error-sym data)))))
(catch result-sym
;; Signals are not passed trough `read-from-minibuffer'.
@@ -130,9 +131,10 @@ the body form as a function."
(execute-kbd-macro
(kbd (mapconcat
#'identity
- (cons unbound-key
- (cl-loop for key in keys collect
- (if (stringp key) key unbound-key)))
+ (nconc (list unbound-key)
+ (cl-loop for key in keys collect
+ (if (stringp key) key unbound-key))
+ (list unbound-key))
" "))))))
(signal (car err) (cdr err))))))
- [nongnu] elpa/with-simulated-input e7e8829eee 020/134: Make SECS arg to wsi-simulated-idle-time optional, (continued)
- [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, 2022/01/10
- [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 <=
- [nongnu] elpa/with-simulated-input 02b5d2c77f 072/134: Fix checkdoc warnings, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4e45836cc0 078/134: Autoload `with-simulated-input--1', ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 89e63ebf6a 073/134: Fix tests for older Emacsen, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 0aeff5f17f 079/134: `with-simulated-input': remove legacy syntax, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 6f7787df80 082/134: Add an unload function, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 26fc928f42 092/134: Work around an incompatibility in Emacs 24 in tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input ef9d5164ca 094/134: Fix interpolation test, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input d3696fb04c 098/134: Check errors more strictly in tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 703fc3c9ec 118/134: Update the docstring for "with-simulated-input", ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 73fa2256df 123/134: Move helper function next to macro, ELPA Syncer, 2022/01/10