branch: elpa/with-simulated-input
commit 82f8bada42ab83074f92491cf20ef2d2edd2befd
Author: Nikita Bloshchanevich <[email protected]>
Commit: Nikita Bloshchanevich <[email protected]>
Fix tests
---
tests/test-with-simulated-input.el | 2 +-
with-simulated-input.el | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/test-with-simulated-input.el
b/tests/test-with-simulated-input.el
index 568eae2590..d2d8a4dd60 100644
--- a/tests/test-with-simulated-input.el
+++ b/tests/test-with-simulated-input.el
@@ -118,7 +118,7 @@
(let ((greeting "hello")
(target "world"))
(expect
- (with-simulated-input (greeting "SPC" (insert target) "RET")
+ (with-simulated-input '(greeting "SPC" (insert target) "RET")
(read-string "Say hello: "))
:to-equal "hello world")))
diff --git a/with-simulated-input.el b/with-simulated-input.el
index 6c3f39af3c..c9d9939e1b 100644
--- a/with-simulated-input.el
+++ b/with-simulated-input.el
@@ -177,13 +177,14 @@ in `progn'."
([¬ symbolp] &rest &or stringp def-form)
form]
def-body)))
- (if (symbolp (car keys))
- (cl-callf list keys)
+ ;; (...) is supposed to be like '(), unless it is a function call or
+ ;; quote/list expression
+ (when (and (listp keys) (not (symbolp (car keys))))
(setq keys `(quote ,keys)))
(pcase keys
(`(quote ,x) (setq keys (cl-loop for key in x collect (if (consp key)
`',key key))))
- (`(list . keys) (cl-callf cdr keys))
- ((guard (not (listp keys))) (cl-callf list keys)))
+ (`(list . ,keys) (cl-callf cdr keys))
+ ((or (guard (not (listp keys))) (guard (symbolp (car keys)))) (cl-callf
list keys)))
`(with-simulated-input--1
(lambda ()
,@body)