branch: elpa/with-simulated-input
commit a86f35f3b0bec0d511c14e4db3e8fd09d074872c
Author: Ryan C. Thompson <[email protected]>
Commit: Ryan C. Thompson <[email protected]>
Add tests for un-quoted lists
Un-quoted lists are likely to become the primary supported way of
passing multiple items as KEYS in the next major version.
---
tests/test-with-simulated-input.el | 46 ++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/tests/test-with-simulated-input.el
b/tests/test-with-simulated-input.el
index a349e47045..82994a2710 100644
--- a/tests/test-with-simulated-input.el
+++ b/tests/test-with-simulated-input.el
@@ -60,6 +60,32 @@
(read-string "Enter a string: "))
:to-equal "hello world"))
+ (it "is an un-quoted list of literal strings"
+ (expect
+ (with-simulated-input ("hello" "RET")
+ (read-string "Enter a string: "))
+ :to-equal "hello"))
+
+ (it "is an un-quoted list of lisp forms"
+ (expect
+ (with-simulated-input ((insert "hello") (exit-minibuffer))
+ (read-string "Enter a string: "))
+ :to-equal "hello"))
+
+ (it "is an un-quoted list of strings and lisp forms"
+ (expect
+ (with-simulated-input ((insert "hello") "RET")
+ (read-string "Enter a string: "))
+ :to-equal "hello")
+ (expect
+ (with-simulated-input ("hello" (exit-minibuffer))
+ (read-string "Enter a string: "))
+ :to-equal "hello")
+ (expect
+ (with-simulated-input ("hello SPC" (insert "world") "RET")
+ (read-string "Enter a string: "))
+ :to-equal "hello world"))
+
(it "is a variable containing any of the above"
(cl-loop
for input in
@@ -88,14 +114,8 @@
(with-simulated-input (concat "hello" " " "RET")
(read-string "Enter a string: "))
:to-equal "hello")
- (let ((my-key-sequence "hello")
+ (let ((my-key-sequence (kbd "hello"))
(my-lisp-form '(insert " world")))
- (expect
- (with-simulated-input '((execute-kbd-macro my-key-sequence)
- (eval my-lisp-form)
- "RET")
- (read-string "Enter a string: "))
- :to-equal "hello world")
(expect
(with-simulated-input (list
my-key-sequence
@@ -103,12 +123,24 @@
"RET")
(read-string "Enter a string: "))
:to-equal "hello world")
+ (expect
+ (with-simulated-input '((execute-kbd-macro my-key-sequence)
+ (eval my-lisp-form)
+ "RET")
+ (read-string "Enter a string: "))
+ :to-equal "hello world")
(expect
(with-simulated-input (list
`(execute-kbd-macro ,my-key-sequence)
`(eval ,my-lisp-form)
"RET")
(read-string "Enter a string: "))
+ :to-equal "hello world")
+ (expect
+ (with-simulated-input `((execute-kbd-macro ,my-key-sequence)
+ (eval ,my-lisp-form)
+ "RET")
+ (read-string "Enter a string: "))
:to-equal "hello world")))
;; This syntax is not known to be used in any real code