; Fix last change to 'ls' error message tests

* test/lisp/dired-tests.el (dired-test-ls-error-message):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-insert-directory): Use
`string-match-p' instead of `equal' because the error message may
report e.g. "/bin/ls" even though the value of
`insert-directory-program' is "ls".
This commit is contained in:
Stephen Berman
2026-04-11 15:40:40 +02:00
parent 15f1b565a2
commit ee9b2db1cf
2 changed files with 10 additions and 4 deletions

View File

@@ -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))))

View File

@@ -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 ()