summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/esh-cmd-tests.el
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-07-09 10:34:31 -0700
committerJim Porter <jporterbugs@gmail.com>2022-09-04 15:15:01 -0700
commit1be925faa1065af5754fc11914b56ae98dfb2a83 (patch)
tree6003dde699588471a1a801705c3ea28bf272ac9f /test/lisp/eshell/esh-cmd-tests.el
parent5af5ed6c6271a452bf37afa0e7349838960d446a (diff)
downloademacs-1be925faa1065af5754fc11914b56ae98dfb2a83.tar.gz
emacs-1be925faa1065af5754fc11914b56ae98dfb2a83.tar.bz2
emacs-1be925faa1065af5754fc11914b56ae98dfb2a83.zip
Simplify Eshell handle functions and add tests/documentation
* lisp/eshell/esh-arg.el (eshell-parse-argument-hook): Explain how to use 'eshell-finish-arg'. * lisp/eshell/esh-io.el (eshell-create-handles): Only call 'eshell-get-target' for stderr if necessary. (eshell-protect-handles): Use 'dotimes'. (eshell-set-output-handle): Pass HANDLES and fix an edge case with setting a duplicate TARGET. * test/lisp/eshell/eshell-tests-helpers.el (eshell-with-temp-buffer): New macro. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/quoted-lisp-form) (esh-cmd-test/backquoted-lisp-form) (esh-cmd-test/backquoted-lisp-form/splice): New tests. * test/lisp/eshell/eshell-tests.el (eshell-test/redirect-buffer) (eshell-test/redirect-buffer-escaped): Move to... * test/lisp/eshell/esh-io-tests.el: ... here, and add other I/O tests. * doc/misc/eshell.texi (Arguments): Add documentation for special argument types. (Input/Output): Expand documentation for redirection and pipelines.
Diffstat (limited to 'test/lisp/eshell/esh-cmd-tests.el')
-rw-r--r--test/lisp/eshell/esh-cmd-tests.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el
index 3a582965d62..92d785d7fdf 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -74,6 +74,25 @@ e.g. \"{(+ 1 2)} 3\" => 3"
(eshell-command-result-equal "{(+ 1 2)} 3" 3))
+;; Lisp forms
+
+(ert-deftest esh-cmd-test/quoted-lisp-form ()
+ "Test parsing of a quoted Lisp form."
+ (eshell-command-result-equal "echo #'(1 2)" '(1 2)))
+
+(ert-deftest esh-cmd-test/backquoted-lisp-form ()
+ "Test parsing of a backquoted Lisp form."
+ (let ((eshell-test-value 42))
+ (eshell-command-result-equal "echo `(answer ,eshell-test-value)"
+ '(answer 42))))
+
+(ert-deftest esh-cmd-test/backquoted-lisp-form/splice ()
+ "Test parsing of a backquoted Lisp form using splicing."
+ (let ((eshell-test-value '(2 3)))
+ (eshell-command-result-equal "echo `(1 ,@eshell-test-value)"
+ '(1 2 3))))
+
+
;; Logical operators
(ert-deftest esh-cmd-test/and-operator ()