branch: elpa/with-simulated-input
commit d3696fb04cb822b677aa43de2ace5096bbbc6f16
Author: Ryan C. Thompson <[email protected]>
Commit: Ryan C. Thompson <[email protected]>
Check errors more strictly in tests
---
tests/test-with-simulated-input.el | 13 ++++++-------
with-simulated-input.el | 2 +-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/tests/test-with-simulated-input.el
b/tests/test-with-simulated-input.el
index fc999af8e7..da4955d12b 100644
--- a/tests/test-with-simulated-input.el
+++ b/tests/test-with-simulated-input.el
@@ -136,14 +136,14 @@
(expect
(with-simulated-input '("hello" (error "Throwing an error from KEYS")
"RET")
(read-string "Enter a string: "))
- :to-throw))
+ :to-throw 'error '("Throwing an error from KEYS")))
(it "caused indirectly by the inputs in KEYS"
(expect
(with-simulated-input
"(error SPC \"Manually SPC throwing SPC an SPC error\") RET"
(command-execute 'eval-expression))
- :to-throw))
+ :to-throw 'error '("Manually throwing an error")))
(it "thrown by BODY"
(expect
@@ -151,13 +151,13 @@
"hello RET"
(read-string "Enter a string: ")
(error "Throwing an error after reading input"))
- :to-throw)
+ :to-throw 'error '("Throwing an error after reading input"))
(expect
(with-simulated-input
"hello RET"
(error "Throwing an error before reading input")
(read-string "Enter a string: "))
- :to-throw))
+ :to-throw 'error '("Throwing an error before reading input")))
(it "from aborting via C-g in KEYS"
(expect
@@ -182,7 +182,7 @@
(expect
(with-simulated-input "hello" ; No RET
(read-string "Enter a string: "))
- :to-throw))
+ :to-throw 'error '("Reached end of simulated input while evaluating
body")))
(it "should throw an error if the input is empty and BODY reads input"
(expect
@@ -275,10 +275,9 @@
;; Suppress messages by replacing `message' with a stub
(spy-on 'message)
(expect
-
(with-simulated-input "bl TAB C-j"
(completing-read "Choose: " my-collection nil t))
- :to-throw)))
+ :to-throw 'error '("Reached end of simulated input while evaluating
body"))))
(describe "should not reproduce past issues:"
;; https://github.com/DarwinAwardWinner/with-simulated-input/issues/4
diff --git a/with-simulated-input.el b/with-simulated-input.el
index 772656dd67..1595ec42c9 100644
--- a/with-simulated-input.el
+++ b/with-simulated-input.el
@@ -116,7 +116,7 @@ the body form as a function."
(throw result-sym (funcall main))))
(cl-remove-if-not #'functionp keys)
(list (lambda ()
- (error "Reached end of simulated input while
simulating body")))))
+ (error "Reached end of simulated input while
evaluating body")))))
(overriding-terminal-local-map
(if overriding-terminal-local-map
(copy-keymap overriding-terminal-local-map)