]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix filelock-tests on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Mon, 12 May 2025 12:08:20 +0000 (15:08 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 12 May 2025 19:55:46 +0000 (21:55 +0200)
* test/src/filelock-tests.el (filelock-tests-file-locked-p-spoiled)
(filelock-tests-unlock-spoiled)
(filelock-tests-kill-buffer-spoiled): Don't special-case
MS-Windows, as it was evidently fixed to signal the same error as
Posix systems.

(cherry picked from commit 8b67e566b9fe156b6be8be0a6381052fa79abc2c)

test/src/filelock-tests.el

index 834019faeab59d06a46c73d875b1fc92a059ae8c..330b78793716089ffbe0a20bf5b009891f57a339 100644 (file)
@@ -123,10 +123,7 @@ the case)."
   (filelock-tests--fixture
    (filelock-tests--spoil-lock-file buffer-file-truename)
    (let ((err (should-error (file-locked-p (buffer-file-name)))))
-     (should (equal (seq-subseq err 0 2)
-                    (if (eq system-type 'windows-nt)
-                        '(permission-denied "Testing file lock")
-                      '(file-error "Testing file lock")))))))
+     (should (equal (seq-subseq err 0 2) '(file-error "Testing file lock"))))))
 
 (ert-deftest filelock-tests-unlock-spoiled ()
   "Check that `unlock-buffer' fails if the lockfile is \"spoiled\"."
@@ -142,11 +139,8 @@ the case)."
    ;; `userlock--handle-unlock-error' (bug#46397).
    (cl-letf (((symbol-function 'userlock--handle-unlock-error)
               (lambda (err) (signal (car err) (cdr err)))))
-     (should (equal
-              (if (eq system-type 'windows-nt)
-                  '(permission-denied "Unlocking file")
-                '(file-error "Unlocking file"))
-              (seq-subseq (should-error (unlock-buffer)) 0 2))))))
+     (should (equal '(file-error "Unlocking file")
+                    (seq-subseq (should-error (unlock-buffer)) 0 2))))))
 
 (ert-deftest filelock-tests-kill-buffer-spoiled ()
   "Check that `kill-buffer' fails if a lockfile is \"spoiled\"."
@@ -168,11 +162,8 @@ the case)."
    (cl-letf (((symbol-function 'yes-or-no-p) #'always)
              ((symbol-function 'userlock--handle-unlock-error)
               (lambda (err) (signal (car err) (cdr err)))))
-     (should (equal
-              (if (eq system-type 'windows-nt)
-                  '(permission-denied "Unlocking file")
-                '(file-error "Unlocking file"))
-              (seq-subseq (should-error (kill-buffer)) 0 2))))))
+     (should (equal '(file-error "Unlocking file")
+                    (seq-subseq (should-error (kill-buffer)) 0 2))))))
 
 (ert-deftest filelock-tests-detect-external-change ()
   "Check that an external file modification is reported."