summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-07-08 18:41:07 -0700
committerLars Ingebrigtsen <larsi@gnus.org>2022-07-12 15:10:56 +0200
commitba1923f1f1bba69bc13620042a00e315946ba82a (patch)
treed85dddc36fb0957a0209fa15bbf1b7dcef339191 /test
parente51ae63ec28c46f37436f649d6421859c1ad0077 (diff)
downloademacs-ba1923f1f1bba69bc13620042a00e315946ba82a.tar.gz
Allow Eshell variable aliases to point to other aliases
In particular, this resolves an issue where '$+' referenced the real environment variable '$PWD' instead of the Eshell variable alias of the same name. This meant that changing directories in Eshell wouldn't update the value of '$+'. * lisp/eshell/esh-var.el (eshell-get-variable): Allow Eshell variable aliaes to point to other aliases. * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/pwd-var) (em-dirs-test/short-pwd-var): Adapt tests to check this case (bug#56509).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/em-dirs-tests.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/lisp/eshell/em-dirs-tests.el b/test/lisp/eshell/em-dirs-tests.el
index eb27acd208e..69480051e49 100644
--- a/test/lisp/eshell/em-dirs-tests.el
+++ b/test/lisp/eshell/em-dirs-tests.el
@@ -36,13 +36,15 @@
(ert-deftest em-dirs-test/pwd-var ()
"Test using the $PWD variable."
- (should (equal (eshell-test-command-result "echo $PWD")
- (expand-file-name (eshell/pwd)))))
+ (let ((default-directory "/some/path"))
+ (should (equal (eshell-test-command-result "echo $PWD")
+ (expand-file-name default-directory)))))
(ert-deftest em-dirs-test/short-pwd-var ()
"Test using the $+ (current directory) variable."
- (should (equal (eshell-test-command-result "echo $+")
- (expand-file-name (eshell/pwd)))))
+ (let ((default-directory "/some/path"))
+ (should (equal (eshell-test-command-result "echo $+")
+ (expand-file-name default-directory)))))
(ert-deftest em-dirs-test/oldpwd-var ()
"Test using the $OLDPWD variable."