From: Eli Zaretskii Date: Thu, 17 Feb 2022 14:30:42 +0000 (+0200) Subject: Fix files-tests on MS-Windows X-Git-Tag: emacs-29.0.90~2264 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a3c5638db653fe3458256d9e58ba41ff50962b83;p=emacs.git Fix files-tests on MS-Windows * test/lisp/files-tests.el (files-tests-zzdont-rewrite-precious-files): Renamed from 'files-tests-dont-rewrite-precious-files', to fix a subtle problem that breaks 2 tests on MS-Windows. (files-tests-revert-buffer) (files-tests-revert-buffer-with-fine-grain): No need to disable file locking anymore. --- diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 5d0a1bc2f37..42b09201de8 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1411,7 +1411,10 @@ See ." (equal tmpfile (executable-find (file-name-nondirectory tmpfile))))))) -(ert-deftest files-tests-dont-rewrite-precious-files () +;; Note: we call this test "...-zzdont..." so that it runs near the +;; end, because otherwise the advice it adds to write-region doesn't +;; get removed(??) and breaks the revert-file tests on MS-Windows. +(ert-deftest files-tests-zzdont-rewrite-precious-files () "Test that `file-precious-flag' forces files to be saved by renaming only, rather than modified in-place." (ert-with-temp-file temp-file-name @@ -1540,13 +1543,10 @@ The door of all subtleties! (ert-with-temp-file temp-file-name (with-temp-buffer (insert files-tests-lao) - ;; Disable lock files, since that barfs in - ;; userlock--check-content-unchanged on MS-Windows. - (let (create-lockfiles) - (write-file temp-file-name) - (erase-buffer) - (insert files-tests-tzu) - (revert-buffer t t t)) + (write-file temp-file-name) + (erase-buffer) + (insert files-tests-tzu) + (revert-buffer t t t) (should (compare-strings files-tests-lao nil nil (buffer-substring (point-min) (point-max)) nil nil))))) @@ -1556,13 +1556,10 @@ The door of all subtleties! (ert-with-temp-file temp-file-name (with-temp-buffer (insert files-tests-lao) - ;; Disable lock files, since that barfs in - ;; userlock--check-content-unchanged on MS-Windows. - (let (create-lockfiles) - (write-file temp-file-name) - (erase-buffer) - (insert files-tests-tzu) - (should (revert-buffer-with-fine-grain t t))) + (write-file temp-file-name) + (erase-buffer) + (insert files-tests-tzu) + (should (revert-buffer-with-fine-grain t t)) (should (compare-strings files-tests-lao nil nil (buffer-substring (point-min) (point-max)) nil nil)))))