diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-05-24 18:56:50 -0700 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-25 14:13:07 +0200 |
commit | 0a79e28891ec7394547358207a8213a7c457a592 (patch) | |
tree | 785cfc7193fdc2cf5925f7d2c37ba211d89cf7c7 /test/lisp/eshell/eshell-tests.el | |
parent | b93c22e67dc856cfc15e488774ebff1f5d151e42 (diff) | |
download | emacs-0a79e28891ec7394547358207a8213a7c457a592.tar.gz |
Reset 'eshell-in-pipeline-p' when interpolating commands
* lisp/eshell/esh-cmd.el (eshell-subcommand-bindings)
(eshell-command-to-value): Set 'eshell-in-pipeline-p' to nil.
* test/lisp/eshell/eshell-tests.el
(eshell-test/subcommand-reset-in-pipeline)
(eshell-test/lisp-reset-in-pipeline): New tests (bug#55620).
Diffstat (limited to 'test/lisp/eshell/eshell-tests.el')
-rw-r--r-- | test/lisp/eshell/eshell-tests.el | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index c0affed80aa..ab5d73d4792 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -130,6 +130,35 @@ e.g. \"{(+ 1 2)} 3\" => 3" (eshell-command-result-p "echo ${*echo hi | *cat} | *cat" "hi"))) +(ert-deftest eshell-test/subcommand-reset-in-pipeline () + "Check that subcommands reset `eshell-in-pipeline-p'." + (skip-unless (executable-find "cat")) + (dolist (template '("echo {%s} | *cat" + "echo ${%s} | *cat" + "*cat $<%s> | *cat")) + (should (equal (eshell-test-command-result + (format template "echo $eshell-in-pipeline-p")) + nil)) + (should (equal (eshell-test-command-result + (format template "echo | echo $eshell-in-pipeline-p")) + "last")) + (should (equal (eshell-test-command-result + (format template "echo $eshell-in-pipeline-p | echo")) + "first")) + (should (equal (eshell-test-command-result + (format template + "echo | echo $eshell-in-pipeline-p | echo")) + "t")))) + +(ert-deftest eshell-test/lisp-reset-in-pipeline () + "Check that interpolated Lisp forms reset `eshell-in-pipeline-p'." + (skip-unless (executable-find "cat")) + (dolist (template '("echo (%s) | *cat" + "echo $(%s) | *cat")) + (should (equal (eshell-test-command-result + (format template "format \"%s\" eshell-in-pipeline-p")) + "nil")))) + (ert-deftest eshell-test/redirect-buffer () "Check that piping to a buffer works" (with-temp-buffer |