aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2023-09-02 22:29:22 -0700
committerJim Porter2024-01-28 16:02:05 -0800
commitd2abe91d4bf68f20e4b1cd39f88ed98fd5731524 (patch)
treef15335a1b5b09ac561256b97264b9a0fd99a2802 /test
parent1f5a13d5843306af2e6a74fbdfd6d00af8804a23 (diff)
downloademacs-d2abe91d4bf68f20e4b1cd39f88ed98fd5731524.tar.gz
emacs-d2abe91d4bf68f20e4b1cd39f88ed98fd5731524.zip
In Eshell, don't expand quoted tildes into a user's home directory
* lisp/eshell/em-dirs.el (eshell-parse-user-reference): Don't expand quoted tildes. * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/expand-user-reference/local) (em-dirs-test/expand-user-reference/quoted): New tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/em-dirs-tests.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-dirs-tests.el b/test/lisp/eshell/em-dirs-tests.el
index 2f170fb0c63..9789e519f4c 100644
--- a/test/lisp/eshell/em-dirs-tests.el
+++ b/test/lisp/eshell/em-dirs-tests.el
@@ -34,6 +34,9 @@
34 default-directory)))) 34 default-directory))))
35;;; Tests: 35;;; Tests:
36 36
37
38;; Variables
39
37(ert-deftest em-dirs-test/pwd-var () 40(ert-deftest em-dirs-test/pwd-var ()
38 "Test using the $PWD variable." 41 "Test using the $PWD variable."
39 (let ((default-directory "/some/path")) 42 (let ((default-directory "/some/path"))
@@ -99,6 +102,25 @@
99 (eshell-match-command-output "echo $-[1][/ 1 3]" 102 (eshell-match-command-output "echo $-[1][/ 1 3]"
100 "(\"some\" \"here\")\n")))) 103 "(\"some\" \"here\")\n"))))
101 104
105
106;; Argument expansion
107
108(ert-deftest em-dirs-test/expand-user-reference/local ()
109 "Test expansion of \"~USER\" references."
110 (eshell-command-result-equal "echo ~" (expand-file-name "~"))
111 (eshell-command-result-equal
112 (format "echo ~%s" user-login-name)
113 (expand-file-name (format "~%s" user-login-name))))
114
115(ert-deftest em-dirs-test/expand-user-reference/quoted ()
116 "Test that a quoted \"~\" isn't expanded."
117 (eshell-command-result-equal "echo \\~" "~")
118 (eshell-command-result-equal "echo \"~\"" "~")
119 (eshell-command-result-equal "echo '~'" "~"))
120
121
122;; `cd'
123
102(ert-deftest em-dirs-test/cd () 124(ert-deftest em-dirs-test/cd ()
103 "Test that changing directories with `cd' works." 125 "Test that changing directories with `cd' works."
104 (ert-with-temp-directory tmpdir 126 (ert-with-temp-directory tmpdir