diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 35795825365..f5f92fd6485 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -767,8 +767,11 @@ hence another buffer should be returned." (should (get-buffer-window errbuf)) (should-not (equal (buffer-name buf) (file-name-nondirectory name))) (with-current-buffer errbuf - (should (equal (funcall ls-err (file-name-nondirectory name)) - (buffer-string)))) + ;; The error message may report e.g. "/bin/ls" even though the + ;; value of `insert-directory-program' is "ls", so we can't + ;; test with `equal'. + (should (string-match-p (funcall ls-err (file-name-nondirectory name)) + (buffer-string)))) (kill-buffer errbuf)) (delete-directory dir t)))) diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 7b049af7070..037e354d841 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1048,8 +1048,11 @@ unquoted file names." (concat (car errlist) fn (cadr errlist)))))) (should errbuf) (with-current-buffer errbuf - (should (equal (funcall ls-err nospecial-dir) - (buffer-string)))) + ;; The error message may report e.g. "/bin/ls" even though the + ;; value of `insert-directory-program' is "ls", so we can't + ;; test with `equal'. + (should (string-match-p (funcall ls-err nospecial-dir) + (buffer-string)))) (kill-buffer errbuf))))) (ert-deftest files-tests-file-name-non-special-insert-file-contents ()