From: Eli Zaretskii Date: Mon, 12 May 2025 12:08:20 +0000 (+0300) Subject: Fix filelock-tests on MS-Windows X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=94feeb8bc18515518d608ba2b80e4a2ce0f6bf3b;p=emacs.git Fix filelock-tests on MS-Windows * 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) --- diff --git a/test/src/filelock-tests.el b/test/src/filelock-tests.el index 834019faeab..330b7879371 100644 --- a/test/src/filelock-tests.el +++ b/test/src/filelock-tests.el @@ -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."