aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2024-08-28 18:53:03 -0700
committerJim Porter2024-08-28 18:53:03 -0700
commite269cf63a67d529740d0ec2382ae7c3a982cd064 (patch)
tree268862c96cd206488541f81c502f5a836251fd68 /test
parent5c68545a936ab42df90c8498ca77207a5e6aff1f (diff)
downloademacs-e269cf63a67d529740d0ec2382ae7c3a982cd064.tar.gz
emacs-e269cf63a67d529740d0ec2382ae7c3a982cd064.zip
Fix redirecting Eshell output to symbols in some places
* lisp/eshell/esh-io.el (eshell-output-object-to-target): Don't require TARGET to be bound. * lisp/eshell/em-script.el (eshell-execute-file): * lisp/eshell/eshell.el (eshell-command): Quote the output/error targets. * test/lisp/eshell/em-script-tests.el (eshell-execute-file-output): New variable. (em-script-test/execute-file/output-symbol): New test. * test/lisp/eshell/eshell-tests.el (eshell-command-output): New variable. (eshell-test/eshell-command/output-symbol): New test (bug#72857).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/em-script-tests.el10
-rw-r--r--test/lisp/eshell/eshell-tests.el6
2 files changed, 16 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-script-tests.el b/test/lisp/eshell/em-script-tests.el
index b9f96fa86db..5e5eb80f215 100644
--- a/test/lisp/eshell/em-script-tests.el
+++ b/test/lisp/eshell/em-script-tests.el
@@ -33,6 +33,9 @@
33 (expand-file-name "eshell-tests-helpers" 33 (expand-file-name "eshell-tests-helpers"
34 (file-name-directory (or load-file-name 34 (file-name-directory (or load-file-name
35 default-directory)))) 35 default-directory))))
36
37(defvar eshell-execute-file-output)
38
36;;; Tests: 39;;; Tests:
37 40
38(ert-deftest em-script-test/source-script () 41(ert-deftest em-script-test/source-script ()
@@ -121,6 +124,13 @@
121 (eshell-execute-file temp-file nil output-file)) 124 (eshell-execute-file temp-file nil output-file))
122 (should (equal (eshell-test-file-string output-file) "moreinitial"))))) 125 (should (equal (eshell-test-file-string output-file) "moreinitial")))))
123 126
127(ert-deftest em-script-test/execute-file/output-symbol ()
128 "Test `eshell-execute-file' redirecting to a symbol."
129 (ert-with-temp-file temp-file :text "echo hi\necho bye"
130 (with-temp-eshell-settings
131 (eshell-execute-file temp-file nil 'eshell-execute-file-output))
132 (should (equal eshell-execute-file-output "hibye"))))
133
124(ert-deftest em-script-test/batch-file () 134(ert-deftest em-script-test/batch-file ()
125 "Test running an Eshell script file as a batch script." 135 "Test running an Eshell script file as a batch script."
126 (ert-with-temp-file temp-file 136 (ert-with-temp-file temp-file
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index c84af62fdbd..e5aeee5123e 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -35,6 +35,7 @@
35 default-directory)))) 35 default-directory))))
36 36
37(defvar eshell-test-value nil) 37(defvar eshell-test-value nil)
38(defvar eshell-command-output)
38 39
39;;; Tests: 40;;; Tests:
40 41
@@ -144,6 +145,11 @@ This test uses a pipeline for the command."
144 (eshell-command "echo more" temp-file) 145 (eshell-command "echo more" temp-file)
145 (should (equal (eshell-test-file-string temp-file) "moreinitial")))) 146 (should (equal (eshell-test-file-string temp-file) "moreinitial"))))
146 147
148(ert-deftest eshell-test/eshell-command/output-symbol ()
149 "Test that `eshell-command' can write to a symbol."
150 (eshell-command "echo hi" 'eshell-command-output)
151 (should (equal eshell-command-output "hi")))
152
147(ert-deftest eshell-test/command-running-p () 153(ert-deftest eshell-test/command-running-p ()
148 "Modeline should show no command running" 154 "Modeline should show no command running"
149 (with-temp-eshell 155 (with-temp-eshell