[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-simulated-input 322dc7ed95 008/134: Add some more tes
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/with-simulated-input 322dc7ed95 008/134: Add some more tests |
Date: |
Mon, 10 Jan 2022 22:59:59 -0500 (EST) |
branch: elpa/with-simulated-input
commit 322dc7ed95f5bc40707ebb1a0f9f8abf552a6e49
Author: Ryan C. Thompson <rct@thompsonclan.org>
Commit: Ryan C. Thompson <rct@thompsonclan.org>
Add some more tests
---
test/with-simulated-input-test.el | 51 +++++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/test/with-simulated-input-test.el
b/test/with-simulated-input-test.el
index be9d7a22e3..43acc0979e 100644
--- a/test/with-simulated-input-test.el
+++ b/test/with-simulated-input-test.el
@@ -4,26 +4,61 @@
(require 'ert)
(require 'cl-lib)
-(ert-deftest simulate-input ()
+(ert-deftest read-simulated-input ()
+ :tags '(with-simulated-input)
"Tests for the basic functionality of the `with-simulated-input' macro."
;; Basic string input
(should
- (string= "hello"
- (with-simulated-input "hello RET"
- (read-string "Enter a string: "))))
+ (string=
+ "hello"
+ (with-simulated-input "hello RET"
+ (read-string "Enter a string: "))))
;; Error if RET is not pressed to finish the input
(should-error
(with-simulated-input "hello"
(read-string "Enter a string: ")))
;; Can throw an error manually
(should-error
- (with-simulated-input "(error SPC \"Manually SPC throwing SPC an SPC
error\") RET"
+ (with-simulated-input
+ "(error SPC \"Manually SPC throwing SPC an SPC error\") RET"
(command-execute 'eval-expression)))
;; Extra keys should not cause errors
(should
- (string= "hello"
- (with-simulated-input "hello RET M-x eval-expression (error SPC
\"Manually SPC throwing SPC an SPC error\") RET"
- (read-string "Enter a string: ")))))
+ (string=
+ "hello"
+ (with-simulated-input
+ "hello RET M-x eval-expression (error SPC \"Manually SPC throwing SPC
an SPC error\") RET"
+ (read-string "Enter a string: "))))
+ ;; A single input sequence can feed multiple functions
+ (should
+ (equal
+ '("hello" "world")
+ (with-simulated-input "hello RET world RET"
+ (list (read-string "First word: ")
+ (read-string "Second word: "))))))
+
+(ert-deftest complete-with-simulated-input ()
+ :tags '(with-simulated-input)
+ "Tests for `with-simulated-input' with `completing-read'."
+ (let ((collection '("bluebird" "blueberry" "bluebell" "bluegrass"
"baseball"))
+ (completing-read-function #'completing-read-default))
+ ;; Unambiguous completion
+ (should
+ (string=
+ "bluebird"
+ ;; First TAB completes "blue", 2nd completes "bird"
+ (with-simulated-input "bl TAB bi TAB RET"
+ (completing-read "Choose: " collection))))
+ ;; Ambiguous completion
+ (should
+ (string=
+ "blue"
+ (with-simulated-input "bl TAB C-j"
+ (completing-read "Choose: " collection))))
+ ;; Ambiguous completion with require-match
+ (should-error
+ (with-simulated-input "bl TAB C-j"
+ (completing-read "Choose: " collection nil t)))))
(provide 'with-simulated-input-test)
- [nongnu] elpa/with-simulated-input a5c955085d 055/134: Fix some warnings in test file, (continued)
- [nongnu] elpa/with-simulated-input a5c955085d 055/134: Fix some warnings in test file, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 0d5e910f19 061/134: Add an error message for unhandled case, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 228732caf5 063/134: Enable undercover in CI, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 2a83333b6d 121/134: Update the edebug spec to include characters, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 166a00980a 131/134: Remove some unused test code, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 6f338aeaed 003/134: Add a README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 5a67067ae0 002/134: Initial version, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4fec23e53b 001/134: Inital empty commit, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9a2ba67eba 009/134: Switch to using buttercup as the test suite, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9d7afd6e6c 007/134: Delete some extraneous whitespace, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 322dc7ed95 008/134: Add some more tests,
ELPA Syncer <=
- [nongnu] elpa/with-simulated-input 4c68e02cc1 010/134: Allow evaluating lisp forms while simulating input, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 5701347987 013/134: Update the readme with new instructions for running tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input ad9eaf2252 014/134: Add info on idle simulation to README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4932368712 016/134: Add MELPA links, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 33b40e59a1 018/134: Fix indentation, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 004218b75c 023/134: Add more info to docstring for wsi-simulated-idle-time, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 395a985348 026/134: Use gensym to generate the canary symbol, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input e66a24d067 031/134: Add Makefile and code coverage, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 1012ccbec7 033/134: Convert defadvice to advice-add, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input d0f7795942 034/134: Update buttercup, ELPA Syncer, 2022/01/10