From ee9b2db1cf036d6f511d7e6eea0189073076e7c0 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sat, 11 Apr 2026 15:40:40 +0200 Subject: [PATCH] ; 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". --- test/lisp/dired-tests.el | 7 +++++-- test/lisp/files-tests.el | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) 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 ()