From 0b0297ad6060884d70c6a23026ac87fb319529ef Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 16 Oct 2020 16:49:47 +0300 Subject: [PATCH] Fix file-name problems in several tests * test/lisp/saveplace-tests.el (saveplace-test-forget-unreadable-files): Use file-truename, to avoid false negatives when file names are not 'equal' as strings, but point to the same file. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-normal-env) (edebug-tests-run-macro): * test/lisp/emacs-lisp/testcover-tests.el (testcover-tests-markup-region, testcover-tests-run-test-case): Bind find-file-suppress-same-file-warnings to a non-nil value, to avoid warnings about "same-file-names", at least on MS-Windows, due to 8+3 aliases. --- test/lisp/emacs-lisp/edebug-tests.el | 4 +++- test/lisp/emacs-lisp/testcover-tests.el | 4 +++- test/lisp/saveplace-tests.el | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el index 6993978ac58..8aae26a1aca 100644 --- a/test/lisp/emacs-lisp/edebug-tests.el +++ b/test/lisp/emacs-lisp/edebug-tests.el @@ -105,7 +105,8 @@ back to the top level.") (declare (debug (body))) `(edebug-tests-with-default-config (let ((edebug-tests-failure-in-post-command nil) - (edebug-tests-temp-file (make-temp-file "edebug-tests-" nil ".el"))) + (edebug-tests-temp-file (make-temp-file "edebug-tests-" nil ".el")) + (find-file-suppress-same-file-warnings t)) (edebug-tests-setup-code-file edebug-tests-temp-file) (ert-with-message-capture edebug-tests-messages @@ -210,6 +211,7 @@ be the same as every keystroke) execute the thunk at the same index." (let* ((edebug-tests-thunks thunks) (edebug-tests-kbd-macro-index 0) + (find-file-suppress-same-file-warnings t) saved-local-map) (with-current-buffer (find-file-noselect edebug-tests-temp-file) (setq saved-local-map overriding-local-map) diff --git a/test/lisp/emacs-lisp/testcover-tests.el b/test/lisp/emacs-lisp/testcover-tests.el index 784367c287e..9e7a3bf31e3 100644 --- a/test/lisp/emacs-lisp/testcover-tests.el +++ b/test/lisp/emacs-lisp/testcover-tests.el @@ -46,6 +46,7 @@ is working correctly on a code sample. OPTARGS are optional arguments for `testcover-start'." (interactive "r") (let ((tempfile (make-temp-file "testcover-tests-" nil ".el")) + (find-file-suppress-same-file-warnings t) (code (buffer-substring beg end)) (marked-up-code)) (unwind-protect @@ -98,7 +99,8 @@ arguments for `testcover-start'." (eval-and-compile (defun testcover-tests-run-test-case (marked-up-code) "Test the operation of Testcover on the string MARKED-UP-CODE." - (let ((tempfile (make-temp-file "testcover-tests-" nil ".el"))) + (let ((tempfile (make-temp-file "testcover-tests-" nil ".el")) + (find-file-suppress-same-file-warnings t)) (unwind-protect (progn (with-temp-file tempfile diff --git a/test/lisp/saveplace-tests.el b/test/lisp/saveplace-tests.el index 27aa2ec1924..8d31e282180 100644 --- a/test/lisp/saveplace-tests.el +++ b/test/lisp/saveplace-tests.el @@ -40,6 +40,7 @@ (ert-deftest saveplace-test-save-place-to-alist/file () (save-place-mode) (let* ((tmpfile (make-temp-file "emacs-test-saveplace-")) + (tmpfile (file-truename tmpfile)) (save-place-alist nil) (save-place-loaded t) (loc tmpfile) -- 2.39.2