Fix Eshell "which" test on MS-Windows
* test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/which/plain/external-program): Compare the file name case-insensitively on case-insensitive file systems. * test/lisp/eshell/eshell-tests-helpers.el (eshell-command-result--equal): Revert to the previous implementation.
This commit is contained in:
parent
8d60b6bab8
commit
aefcccc1d4
2 changed files with 11 additions and 8 deletions
|
@ -538,8 +538,16 @@ NAME is the name of the test case."
|
|||
(ert-deftest esh-cmd-test/which/plain/external-program ()
|
||||
"Check that `which' finds external programs."
|
||||
(skip-unless (executable-find "sh"))
|
||||
(eshell-command-result-equal "which sh"
|
||||
(concat (executable-find "sh") "\n")))
|
||||
(ert-info (#'eshell-get-debug-logs :prefix "Command logs: ")
|
||||
(let ((actual (eshell-test-command-result "which sh"))
|
||||
(expected (concat (executable-find "sh") "\n")))
|
||||
;; Eshell handles the casing of the PATH differently from
|
||||
;; `executable-find'. This means that the results may not match
|
||||
;; exactly on case-insensitive file systems (e.g. when using
|
||||
;; MS-Windows), so compare case-insensitively there.
|
||||
(should (if (file-name-case-insensitive-p actual)
|
||||
(string-equal-ignore-case actual expected)
|
||||
(string-equal actual expected))))))
|
||||
|
||||
(ert-deftest esh-cmd-test/which/plain/not-found ()
|
||||
"Check that `which' reports an error for not-found commands."
|
||||
|
|
|
@ -179,12 +179,7 @@ inserting the command."
|
|||
|
||||
(defun eshell-command-result--equal (_command actual expected)
|
||||
"Compare the ACTUAL result of a COMMAND with its EXPECTED value."
|
||||
(or (equal actual expected)
|
||||
;; Compare case-isensitively on case-insensitive filesystems.
|
||||
(and (memq system-type '(windows-nt ms-dos))
|
||||
(stringp actual)
|
||||
(stringp expected)
|
||||
(string-equal-ignore-case actual expected))))
|
||||
(equal actual expected))
|
||||
|
||||
(defun eshell-command-result--equal-explainer (command actual expected)
|
||||
"Explain the result of `eshell-command-result--equal'."
|
||||
|
|
Loading…
Add table
Reference in a new issue