]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix files-tests on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Thu, 17 Feb 2022 14:30:42 +0000 (16:30 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 17 Feb 2022 14:30:42 +0000 (16:30 +0200)
* 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.

test/lisp/files-tests.el

index 5d0a1bc2f375ad45088a77b43b73ff9755d17c92..42b09201de832c92d2c7d3b152995bbdb010fb8a 100644 (file)
@@ -1411,7 +1411,10 @@ See <https://debbugs.gnu.org/35241>."
        (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)))))