diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-04-26 21:53:00 -0700 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-01 20:41:23 +0200 |
commit | 32ab756d82b39a9706ff8990dcf6eb074818c66e (patch) | |
tree | 02ed3cc35efaa27f8048f5b519bbfcdcad57aa2b /test/lisp/eshell/eshell-tests.el | |
parent | bb40507fed7b211bb0ef5b5e3dcc609876f6ad8d (diff) | |
download | emacs-32ab756d82b39a9706ff8990dcf6eb074818c66e.tar.gz |
Handle escaped characters in Eshell special references (e.g. buffers)
* lisp/eshell/esh-arg.el (eshell-parse-special-reference): Unescape
escaped characters.
* test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell): Restore
current buffer after evaluating BODY.
* test/lisp/eshell/eshell-tests.el (eshell-test/redirect-buffer)
(eshell-test/redirect-buffer-escaped): New tests (bug#55204).
Diffstat (limited to 'test/lisp/eshell/eshell-tests.el')
-rw-r--r-- | test/lisp/eshell/eshell-tests.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index bcc2dc320b2..7cdeb017e44 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -114,6 +114,25 @@ e.g. \"{(+ 1 2)} 3\" => 3" (eshell-wait-for-subprocess) (eshell-match-result "OLLEH\n"))) +(ert-deftest eshell-test/redirect-buffer () + "Check that piping to a buffer works" + (with-temp-buffer + (rename-buffer "eshell-temp-buffer" t) + (let ((bufname (buffer-name))) + (with-temp-eshell + (eshell-insert-command (format "echo hi > #<%s>" bufname))) + (should (equal (buffer-string) "hi"))))) + +(ert-deftest eshell-test/redirect-buffer-escaped () + "Check that piping to a buffer with escaped characters works" + (with-temp-buffer + (rename-buffer "eshell\\temp\\buffer" t) + (let ((bufname (buffer-name))) + (with-temp-eshell + (eshell-insert-command (format "echo hi > #<%s>" + (string-replace "\\" "\\\\" bufname)))) + (should (equal (buffer-string) "hi"))))) + (ert-deftest eshell-test/inside-emacs-var () "Test presence of \"INSIDE_EMACS\" in subprocesses" (with-temp-eshell |