aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/eshell/esh-cmd-tests.el
diff options
context:
space:
mode:
authorJim Porter2023-01-24 17:14:54 -0800
committerJim Porter2023-02-09 21:38:07 -0800
commitc53255f67758cbd528c3422e248c0cb979a9a676 (patch)
tree29bbfc451181b57dd43ad2520a269003416f22ef /test/lisp/eshell/esh-cmd-tests.el
parentd6d25a3c221e566de4df5319181e9ba9a8df285e (diff)
downloademacs-c53255f67758cbd528c3422e248c0cb979a9a676.tar.gz
emacs-c53255f67758cbd528c3422e248c0cb979a9a676.zip
Ensure that deferred commands don't make Eshell forget let-bound values
* lisp/eshell/esh-cmd.el (Command evaluation macros): Expand this documentation to list allowed special forms and caveats for working with 'if' and 'while'. (eshell-do-eval): Provide more detail in docstring. Handle 'eshell-defer' inside 'let' forms. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/let-rebinds-after-defer): New test (bug#59469).
Diffstat (limited to 'test/lisp/eshell/esh-cmd-tests.el')
-rw-r--r--test/lisp/eshell/esh-cmd-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el
index bcecc9a531f..94763954622 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -73,6 +73,23 @@ Test that trailing arguments outside the subcommand are ignored.
73e.g. \"{(+ 1 2)} 3\" => 3" 73e.g. \"{(+ 1 2)} 3\" => 3"
74 (eshell-command-result-equal "{(+ 1 2)} 3" 3)) 74 (eshell-command-result-equal "{(+ 1 2)} 3" 3))
75 75
76(ert-deftest esh-cmd-test/let-rebinds-after-defer ()
77 "Test that let-bound values are properly updated after `eshell-defer'.
78When inside a `let' block in an Eshell command form, we need to
79ensure that deferred commands update any let-bound variables so
80they have the correct values when resuming evaluation. See
81bug#59469."
82 (skip-unless (executable-find "echo"))
83 (with-temp-eshell
84 (eshell-match-command-output
85 (concat "{"
86 " export LOCAL=value; "
87 " echo \"$LOCAL\"; "
88 " *echo external; " ; This will throw `eshell-defer'.
89 " echo \"$LOCAL\"; "
90 "}")
91 "value\nexternal\nvalue\n")))
92
76 93
77;; Lisp forms 94;; Lisp forms
78 95