diff options
| author | Jim Porter | 2023-08-27 12:49:25 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-08-27 12:49:25 -0700 |
| commit | bc0426ce8ed7d58eb228ee1c78679db43d4a9cb0 (patch) | |
| tree | 180701f44744e13056d44806288befc064371886 /test | |
| parent | 34f7a47c9ce0581a89b30cc06243788b354f2e7a (diff) | |
| download | emacs-bc0426ce8ed7d58eb228ee1c78679db43d4a9cb0.tar.gz emacs-bc0426ce8ed7d58eb228ee1c78679db43d4a9cb0.zip | |
Don't add an extraneous slash in remote PATH list in Eshell
Previously, in a remote directory, '(eshell-get-path)' would return a
list of strings like "/ssh:localhost://usr/bin". While that shouldn't
break most things, it's not strictly correct either. See bug#65551.
* lisp/eshell/esh-util.el (eshell-get-path): Use 'concat' instead of
'file-name-concat'.
* test/lisp/eshell/esh-util-tests.el: Require 'tramp' and
'eshell-tests-helpers'.
(esh-util-test/path/get, eshell-util-test/path/get-remote): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/esh-util-tests.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-util-tests.el b/test/lisp/eshell/esh-util-tests.el index afaf1b77f2b..9546a4a62fd 100644 --- a/test/lisp/eshell/esh-util-tests.el +++ b/test/lisp/eshell/esh-util-tests.el | |||
| @@ -19,9 +19,15 @@ | |||
| 19 | 19 | ||
| 20 | ;;; Code: | 20 | ;;; Code: |
| 21 | 21 | ||
| 22 | (require 'tramp) | ||
| 22 | (require 'ert) | 23 | (require 'ert) |
| 23 | (require 'esh-util) | 24 | (require 'esh-util) |
| 24 | 25 | ||
| 26 | (require 'eshell-tests-helpers | ||
| 27 | (expand-file-name "eshell-tests-helpers" | ||
| 28 | (file-name-directory (or load-file-name | ||
| 29 | default-directory)))) | ||
| 30 | |||
| 25 | ;;; Tests: | 31 | ;;; Tests: |
| 26 | 32 | ||
| 27 | (ert-deftest esh-util-test/eshell-stringify/string () | 33 | (ert-deftest esh-util-test/eshell-stringify/string () |
| @@ -54,4 +60,28 @@ | |||
| 54 | "Test that `eshell-stringify' correctly stringifies complex objects." | 60 | "Test that `eshell-stringify' correctly stringifies complex objects." |
| 55 | (should (equal (eshell-stringify (list 'quote 'hello)) "'hello"))) | 61 | (should (equal (eshell-stringify (list 'quote 'hello)) "'hello"))) |
| 56 | 62 | ||
| 63 | (ert-deftest esh-util-test/path/get () | ||
| 64 | "Test that getting the Eshell path returns the expected results." | ||
| 65 | (let ((expected-path (butlast (exec-path)))) | ||
| 66 | (should (equal (eshell-get-path) | ||
| 67 | (if (eshell-under-windows-p) | ||
| 68 | (cons "." expected-path) | ||
| 69 | expected-path))) | ||
| 70 | (should (equal (eshell-get-path 'literal) | ||
| 71 | expected-path)))) | ||
| 72 | |||
| 73 | (ert-deftest esh-util-test/path/get-remote () | ||
| 74 | "Test that getting the remote Eshell path returns the expected results." | ||
| 75 | (let* ((default-directory ert-remote-temporary-file-directory) | ||
| 76 | (expected-path (butlast (exec-path)))) | ||
| 77 | ;; Make sure we don't have a doubled directory separator. | ||
| 78 | (should (seq-every-p (lambda (i) (not (string-match-p "//" i))) | ||
| 79 | (eshell-get-path))) | ||
| 80 | (should (equal (eshell-get-path) | ||
| 81 | (mapcar (lambda (i) | ||
| 82 | (concat (file-remote-p default-directory) i)) | ||
| 83 | expected-path))) | ||
| 84 | (should (equal (eshell-get-path 'literal) | ||
| 85 | expected-path)))) | ||
| 86 | |||
| 57 | ;;; esh-util-tests.el ends here | 87 | ;;; esh-util-tests.el ends here |