aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/eshell/esh-util-tests.el
diff options
context:
space:
mode:
authorJim Porter2024-10-26 14:22:38 -0700
committerJim Porter2024-10-26 14:24:39 -0700
commitd6fe32e531044b518ae5b6b39377378cbf13292d (patch)
treeb667eeb56fb74ed37f96da4104d34b880cd29462 /test/lisp/eshell/esh-util-tests.el
parent02510606f6d0e431e36634b8290e648b3a47af18 (diff)
downloademacs-d6fe32e531044b518ae5b6b39377378cbf13292d.tar.gz
emacs-d6fe32e531044b518ae5b6b39377378cbf13292d.zip
; Ensure 'eshell-split-filename' doesn't expand the filename first
* lisp/eshell/esh-util.el (eshell-split-filename): Never expand the filename. * lisp/eshell/em-glob.el (eshell-glob-p): A leading "~" isn't a globbing character. * test/lisp/eshell/esh-util-tests.el (esh-util-test/split-filename/absolute) (esh-util-test/split-filename/relative) (esh-util-test/split-filename/user) (esh-util-test/split-filename/remote-absolute) (esh-util-test/split-filename/remote-relative) (esh-util-test/split-filename/remote-user): New tests.
Diffstat (limited to 'test/lisp/eshell/esh-util-tests.el')
-rw-r--r--test/lisp/eshell/esh-util-tests.el40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-util-tests.el b/test/lisp/eshell/esh-util-tests.el
index 4a0874bff39..b2fd01e0c29 100644
--- a/test/lisp/eshell/esh-util-tests.el
+++ b/test/lisp/eshell/esh-util-tests.el
@@ -183,4 +183,44 @@
183 (should (equal (eshell-get-path 'literal) 183 (should (equal (eshell-get-path 'literal)
184 expected-path)))) 184 expected-path))))
185 185
186(ert-deftest esh-util-test/split-filename/absolute ()
187 "Test splitting an absolute filename."
188 (should (equal (eshell-split-filename "/foo/bar/file.txt")
189 '("/" "foo/" "bar/" "file.txt"))))
190
191(ert-deftest esh-util-test/split-filename/relative ()
192 "Test splitting a relative filename."
193 (should (equal (eshell-split-filename "foo/bar/file.txt")
194 '("foo/" "bar/" "file.txt"))))
195
196(ert-deftest esh-util-test/split-filename/user ()
197 "Test splitting a user filename."
198 (should (equal (eshell-split-filename "~/file.txt")
199 '("~/" "file.txt")))
200 (should (equal (eshell-split-filename "~user/file.txt")
201 '("~user/" "file.txt"))))
202
203(ert-deftest esh-util-test/split-filename/remote-absolute ()
204 "Test splitting a remote absolute filename."
205 (skip-unless (eshell-tests-remote-accessible-p))
206 (let ((remote (file-remote-p ert-remote-temporary-file-directory)))
207 (should (equal (eshell-split-filename (format "%s/foo/bar/file.txt" remote))
208 `(,remote "/" "foo/" "bar/" "file.txt")))))
209
210(ert-deftest esh-util-test/split-filename/remote-relative ()
211 "Test splitting a remote relative filename."
212 (skip-unless (eshell-tests-remote-accessible-p))
213 (let ((remote (file-remote-p ert-remote-temporary-file-directory)))
214 (should (equal (eshell-split-filename (format "%sfoo/bar/file.txt" remote))
215 `(,remote "foo/" "bar/" "file.txt")))))
216
217(ert-deftest esh-util-test/split-filename/remote-user ()
218 "Test splitting a remote user filename."
219 (skip-unless (eshell-tests-remote-accessible-p))
220 (let ((remote (file-remote-p ert-remote-temporary-file-directory)))
221 (should (equal (eshell-split-filename (format "%s~/file.txt" remote))
222 `(,remote "~/" "file.txt")))
223 (should (equal (eshell-split-filename (format "%s~user/file.txt" remote))
224 `(,remote "~user/" "file.txt")))))
225
186;;; esh-util-tests.el ends here 226;;; esh-util-tests.el ends here