summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/eshell-tests.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-08-13 20:31:11 -0700
committerJim Porter <jporterbugs@gmail.com>2022-08-15 20:40:27 -0700
commit07b8fb197a3057a3419be0335236547e4d7a326b (patch)
tree52b631c5f3cc6370223e1d9f7920b7b3af37f197 /test/lisp/eshell/eshell-tests.el
parent1973d4ac1b613bdd6c70e1ef2bac97b538fbb2ed (diff)
downloademacs-07b8fb197a3057a3419be0335236547e4d7a326b.tar.gz
Provide ERT explainer for 'eshell-match-command-output'
This was formerly named 'eshell-command-result-p', but "result" isn't quite the right terminology, since this function specifically tested the output of a command, not its Lisp result (as 'eshell-command-result' would return). * test/lisp/eshell/eshell-tests-helpers.el (eshell-insert-command): Provide a more-complete docstring. (eshell-match-result): Rename to... (eshell-match-output): ... this. (eshell-match-output--explainer): New function. (eshell-command-result-p): Rename to... (eshell-match-command-output): ... this. * test/lisp/eshell/em-alias-tests.el * test/lisp/eshell/em-dirs-tests.el * test/lisp/eshell/em-extpipe-tests.el * test/lisp/eshell/em-script-tests.el * test/lisp/eshell/esh-cmd-tests.el * test/lisp/eshell/esh-proc-tests.el * test/lisp/eshell/esh-var-tests.el * test/lisp/eshell/eshell-tests-helpers.el * test/lisp/eshell/eshell-tests.el: Use 'eshell-match-command-output'.
Diffstat (limited to 'test/lisp/eshell/eshell-tests.el')
-rw-r--r--test/lisp/eshell/eshell-tests.el44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index 8423500ea7d..c7a9516bea4 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -40,15 +40,15 @@
"Check that piping a non-process to a process command waits for the process"
(skip-unless (executable-find "cat"))
(with-temp-eshell
- (eshell-command-result-p "echo hi | *cat"
- "hi")))
+ (eshell-match-command-output "echo hi | *cat"
+ "hi")))
(ert-deftest eshell-test/pipe-tailproc ()
"Check that piping a process to a non-process command waits for the process"
(skip-unless (executable-find "echo"))
(with-temp-eshell
- (eshell-command-result-p "*echo hi | echo bye"
- "bye\nhi\n")))
+ (eshell-match-command-output "*echo hi | echo bye"
+ "bye\nhi\n")))
(ert-deftest eshell-test/pipe-headproc-stdin ()
"Check that standard input is sent to the head process in a pipeline"
@@ -59,23 +59,23 @@
(eshell-insert-command "hello")
(eshell-send-eof-to-process)
(eshell-wait-for-subprocess)
- (eshell-match-result "OLLEH\n")))
+ (should (eshell-match-output "OLLEH\n"))))
(ert-deftest eshell-test/pipe-subcommand ()
"Check that piping with an asynchronous subcommand works"
(skip-unless (and (executable-find "echo")
(executable-find "cat")))
(with-temp-eshell
- (eshell-command-result-p "echo ${*echo hi} | *cat"
- "hi")))
+ (eshell-match-command-output "echo ${*echo hi} | *cat"
+ "hi")))
(ert-deftest eshell-test/pipe-subcommand-with-pipe ()
"Check that piping with an asynchronous subcommand with its own pipe works"
(skip-unless (and (executable-find "echo")
(executable-find "cat")))
(with-temp-eshell
- (eshell-command-result-p "echo ${*echo hi | *cat} | *cat"
- "hi")))
+ (eshell-match-command-output "echo ${*echo hi | *cat} | *cat"
+ "hi")))
(ert-deftest eshell-test/subcommand-reset-in-pipeline ()
"Check that subcommands reset `eshell-in-pipeline-p'."
@@ -129,32 +129,32 @@
"Test that \"\\c\" and \"c\" are equivalent when \"c\" is not a
special character."
(with-temp-eshell
- (eshell-command-result-p "echo he\\llo"
- "hello\n")))
+ (eshell-match-command-output "echo he\\llo"
+ "hello\n")))
(ert-deftest eshell-test/escape-nonspecial-unicode ()
"Test that \"\\c\" and \"c\" are equivalent when \"c\" is a
unicode character (unicode characters are nonspecial by
definition)."
(with-temp-eshell
- (eshell-command-result-p "echo Vid\\éos"
- "Vidéos\n")))
+ (eshell-match-command-output "echo Vid\\éos"
+ "Vidéos\n")))
(ert-deftest eshell-test/escape-nonspecial-quoted ()
"Test that the backslash is preserved for escaped nonspecial
chars"
(with-temp-eshell
- (eshell-command-result-p "echo \"h\\i\""
- ;; Backslashes are doubled for regexp.
- "h\\\\i\n")))
+ (eshell-match-command-output "echo \"h\\i\""
+ ;; Backslashes are doubled for regexp.
+ "h\\\\i\n")))
(ert-deftest eshell-test/escape-special-quoted ()
"Test that the backslash is not preserved for escaped special
chars"
(with-temp-eshell
- (eshell-command-result-p "echo \"\\\"hi\\\\\""
- ;; Backslashes are doubled for regexp.
- "\\\"hi\\\\\n")))
+ (eshell-match-command-output "echo \"\\\"hi\\\\\""
+ ;; Backslashes are doubled for regexp.
+ "\\\"hi\\\\\n")))
(ert-deftest eshell-test/command-running-p ()
"Modeline should show no command running"
@@ -188,15 +188,15 @@ chars"
(> count 0))
(sit-for 1)
(setq count (1- count))))
- (eshell-match-result "alpha\n")))
+ (should (eshell-match-output "alpha\n"))))
(ert-deftest eshell-test/flush-output ()
"Test flushing of previous output"
(with-temp-eshell
(eshell-insert-command "echo alpha")
(eshell-kill-output)
- (eshell-match-result
- (concat "^" (regexp-quote "*** output flushed ***\n") "$"))))
+ (should (eshell-match-output
+ (concat "^" (regexp-quote "*** output flushed ***\n") "$")))))
(ert-deftest eshell-test/run-old-command ()
"Re-run an old command"