(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."
(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'."