aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii2025-05-12 15:08:20 +0300
committerEli Zaretskii2025-05-12 15:08:20 +0300
commit8b67e566b9fe156b6be8be0a6381052fa79abc2c (patch)
tree5ca720bd03348fa6f9be82c707fbce38c5091a2f /test
parent4ddafede8d7bebdaa795279cc4c527e5fe425add (diff)
downloademacs-8b67e566b9fe156b6be8be0a6381052fa79abc2c.tar.gz
emacs-8b67e566b9fe156b6be8be0a6381052fa79abc2c.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/src/filelock-tests.el19
1 files changed, 5 insertions, 14 deletions
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)."
123 (filelock-tests--fixture 123 (filelock-tests--fixture
124 (filelock-tests--spoil-lock-file buffer-file-truename) 124 (filelock-tests--spoil-lock-file buffer-file-truename)
125 (let ((err (should-error (file-locked-p (buffer-file-name))))) 125 (let ((err (should-error (file-locked-p (buffer-file-name)))))
126 (should (equal (seq-subseq err 0 2) 126 (should (equal (seq-subseq err 0 2) '(file-error "Testing file lock"))))))
127 (if (eq system-type 'windows-nt)
128 '(permission-denied "Testing file lock")
129 '(file-error "Testing file lock")))))))
130 127
131(ert-deftest filelock-tests-unlock-spoiled () 128(ert-deftest filelock-tests-unlock-spoiled ()
132 "Check that `unlock-buffer' fails if the lockfile is \"spoiled\"." 129 "Check that `unlock-buffer' fails if the lockfile is \"spoiled\"."
@@ -142,11 +139,8 @@ the case)."
142 ;; `userlock--handle-unlock-error' (bug#46397). 139 ;; `userlock--handle-unlock-error' (bug#46397).
143 (cl-letf (((symbol-function 'userlock--handle-unlock-error) 140 (cl-letf (((symbol-function 'userlock--handle-unlock-error)
144 (lambda (err) (signal (car err) (cdr err))))) 141 (lambda (err) (signal (car err) (cdr err)))))
145 (should (equal 142 (should (equal '(file-error "Unlocking file")
146 (if (eq system-type 'windows-nt) 143 (seq-subseq (should-error (unlock-buffer)) 0 2))))))
147 '(permission-denied "Unlocking file")
148 '(file-error "Unlocking file"))
149 (seq-subseq (should-error (unlock-buffer)) 0 2))))))
150 144
151(ert-deftest filelock-tests-kill-buffer-spoiled () 145(ert-deftest filelock-tests-kill-buffer-spoiled ()
152 "Check that `kill-buffer' fails if a lockfile is \"spoiled\"." 146 "Check that `kill-buffer' fails if a lockfile is \"spoiled\"."
@@ -168,11 +162,8 @@ the case)."
168 (cl-letf (((symbol-function 'yes-or-no-p) #'always) 162 (cl-letf (((symbol-function 'yes-or-no-p) #'always)
169 ((symbol-function 'userlock--handle-unlock-error) 163 ((symbol-function 'userlock--handle-unlock-error)
170 (lambda (err) (signal (car err) (cdr err))))) 164 (lambda (err) (signal (car err) (cdr err)))))
171 (should (equal 165 (should (equal '(file-error "Unlocking file")
172 (if (eq system-type 'windows-nt) 166 (seq-subseq (should-error (kill-buffer)) 0 2))))))
173 '(permission-denied "Unlocking file")
174 '(file-error "Unlocking file"))
175 (seq-subseq (should-error (kill-buffer)) 0 2))))))
176 167
177(ert-deftest filelock-tests-detect-external-change () 168(ert-deftest filelock-tests-detect-external-change ()
178 "Check that an external file modification is reported." 169 "Check that an external file modification is reported."