aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii2023-03-02 14:21:33 +0200
committerEli Zaretskii2023-03-02 14:21:33 +0200
commit756225e37783a7b8fe73be1280c82f521e72d60f (patch)
treee5ee6369420f423d0e397fdb5a2a9753657bb161 /test
parenta137f71c67e88204a32ebd747beb8fdd7db2fbe9 (diff)
downloademacs-756225e37783a7b8fe73be1280c82f521e72d60f.tar.gz
emacs-756225e37783a7b8fe73be1280c82f521e72d60f.zip
Fix wdired-tests on MS-Windows
* test/lisp/wdired-tests.el (wdired-test-bug32173-01) (wdired-test-bug32173-02, wdired-test-unfinished-edit-01) (wdired-test-bug39280): Run test-dir through file-truename, to avoid failures due to MS-Windows "numeric tails" (mis)feature and similar issues, which make file names fail to compare 'equal'. (wdired-test-bug34915, wdired-test-bug61510): Skip if symlinks fail.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/wdired-tests.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index 897c6cd69a8..20caaff17c7 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -31,6 +31,10 @@
31 "Test using non-nil wdired-use-interactive-rename. 31 "Test using non-nil wdired-use-interactive-rename.
32Partially modifying a file name should succeed." 32Partially modifying a file name should succeed."
33 (ert-with-temp-directory test-dir 33 (ert-with-temp-directory test-dir
34 ;; The call to file-truename is for MS-Windows, where numeric
35 ;; tails or some other feature (like SUBST) could cause file names
36 ;; to fail to compare 'equal'.
37 (setq test-dir (file-truename test-dir))
34 (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c")) 38 (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c"))
35 (replace "bar") 39 (replace "bar")
36 (new-file (string-replace "foo" replace test-file)) 40 (new-file (string-replace "foo" replace test-file))
@@ -56,6 +60,7 @@ Partially modifying a file name should succeed."
56 "Test using non-nil wdired-use-interactive-rename. 60 "Test using non-nil wdired-use-interactive-rename.
57Aborting an edit should leaving original file name unchanged." 61Aborting an edit should leaving original file name unchanged."
58 (ert-with-temp-directory test-dir 62 (ert-with-temp-directory test-dir
63 (setq test-dir (file-truename test-dir))
59 (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c")) 64 (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c"))
60 (wdired-use-interactive-rename t)) 65 (wdired-use-interactive-rename t))
61 (write-region "" nil test-file nil 'silent) 66 (write-region "" nil test-file nil 'silent)
@@ -106,6 +111,7 @@ only the name before the link arrow."
106Finding the new name should be possible while still in 111Finding the new name should be possible while still in
107wdired-mode." 112wdired-mode."
108 (ert-with-temp-directory test-dir 113 (ert-with-temp-directory test-dir
114 (setq test-dir (file-truename test-dir))
109 (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c")) 115 (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c"))
110 (replace "bar") 116 (replace "bar")
111 (new-file (string-replace "foo" replace test-file))) 117 (new-file (string-replace "foo" replace test-file)))
@@ -143,7 +149,11 @@ wdired-get-filename before and after editing."
143 (with-current-buffer buf 149 (with-current-buffer buf
144 (dired-create-empty-file "foo") 150 (dired-create-empty-file "foo")
145 (set-file-modes "foo" (file-modes-symbolic-to-number "+x")) 151 (set-file-modes "foo" (file-modes-symbolic-to-number "+x"))
146 (make-symbolic-link "foo" "bar") 152 (skip-unless
153 ;; This check is for wdired, not symbolic links, so skip
154 ;; it when make-symbolic-link fails for any reason (like
155 ;; insufficient privileges).
156 (ignore-errors (make-symbolic-link "foo" "bar") t))
147 (make-directory "foodir") 157 (make-directory "foodir")
148 (dired-smart-shell-command "mkfifo foopipe") 158 (dired-smart-shell-command "mkfifo foopipe")
149 (when (featurep 'make-network-process '(:family local)) 159 (when (featurep 'make-network-process '(:family local))
@@ -176,6 +186,7 @@ wdired-get-filename before and after editing."
176(ert-deftest wdired-test-bug39280 () 186(ert-deftest wdired-test-bug39280 ()
177 "Test for https://debbugs.gnu.org/39280." 187 "Test for https://debbugs.gnu.org/39280."
178 (ert-with-temp-directory test-dir 188 (ert-with-temp-directory test-dir
189 (setq test-dir (file-truename test-dir))
179 (let* ((fname "foo") 190 (let* ((fname "foo")
180 (full-fname (expand-file-name fname test-dir))) 191 (full-fname (expand-file-name fname test-dir)))
181 (make-empty-file full-fname) 192 (make-empty-file full-fname)
@@ -202,7 +213,11 @@ should be invisible again."
202 (dired-hide-details-hide-symlink-targets t)) 213 (dired-hide-details-hide-symlink-targets t))
203 (unwind-protect 214 (unwind-protect
204 (with-current-buffer buf 215 (with-current-buffer buf
205 (make-symbolic-link "bar" "foo") 216 (skip-unless
217 ;; This check is for wdired, not symbolic links, so skip
218 ;; it when make-symbolic-link fails for any reason (like
219 ;; insufficient privileges).
220 (ignore-errors (make-symbolic-link "bar" "foo") t))
206 (dired-hide-details-mode) 221 (dired-hide-details-mode)
207 (should (memq 'dired-hide-details-link buffer-invisibility-spec)) 222 (should (memq 'dired-hide-details-link buffer-invisibility-spec))
208 (dired-toggle-read-only) 223 (dired-toggle-read-only)