emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 756225e3778: Fix wdired-tests on MS-Windows


From: Eli Zaretskii
Subject: emacs-29 756225e3778: Fix wdired-tests on MS-Windows
Date: Thu, 2 Mar 2023 07:22:12 -0500 (EST)

branch: emacs-29
commit 756225e37783a7b8fe73be1280c82f521e72d60f
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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.
---
 test/lisp/wdired-tests.el | 19 +++++++++++++++++--
 1 file 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 @@
   "Test using non-nil wdired-use-interactive-rename.
 Partially modifying a file name should succeed."
   (ert-with-temp-directory test-dir
+    ;; The call to file-truename is for MS-Windows, where numeric
+    ;; tails or some other feature (like SUBST) could cause file names
+    ;; to fail to compare 'equal'.
+    (setq test-dir (file-truename test-dir))
     (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c"))
            (replace "bar")
            (new-file (string-replace "foo" replace test-file))
@@ -56,6 +60,7 @@ Partially modifying a file name should succeed."
   "Test using non-nil wdired-use-interactive-rename.
 Aborting an edit should leaving original file name unchanged."
   (ert-with-temp-directory test-dir
+    (setq test-dir (file-truename test-dir))
     (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c"))
            (wdired-use-interactive-rename t))
       (write-region "" nil test-file nil 'silent)
@@ -106,6 +111,7 @@ only the name before the link arrow."
 Finding the new name should be possible while still in
 wdired-mode."
   (ert-with-temp-directory test-dir
+    (setq test-dir (file-truename test-dir))
     (let* ((test-file (concat (file-name-as-directory test-dir) "foo.c"))
            (replace "bar")
            (new-file (string-replace "foo" replace test-file)))
@@ -143,7 +149,11 @@ wdired-get-filename before and after editing."
             (with-current-buffer buf
               (dired-create-empty-file "foo")
               (set-file-modes "foo" (file-modes-symbolic-to-number "+x"))
-              (make-symbolic-link "foo" "bar")
+              (skip-unless
+               ;; This check is for wdired, not symbolic links, so skip
+               ;; it when make-symbolic-link fails for any reason (like
+               ;; insufficient privileges).
+               (ignore-errors (make-symbolic-link "foo" "bar") t))
               (make-directory "foodir")
               (dired-smart-shell-command "mkfifo foopipe")
               (when (featurep 'make-network-process '(:family local))
@@ -176,6 +186,7 @@ wdired-get-filename before and after editing."
 (ert-deftest wdired-test-bug39280 ()
   "Test for https://debbugs.gnu.org/39280.";
   (ert-with-temp-directory test-dir
+    (setq test-dir (file-truename test-dir))
     (let* ((fname "foo")
            (full-fname (expand-file-name fname test-dir)))
       (make-empty-file full-fname)
@@ -202,7 +213,11 @@ should be invisible again."
           (dired-hide-details-hide-symlink-targets t))
       (unwind-protect
           (with-current-buffer buf
-            (make-symbolic-link "bar" "foo")
+            (skip-unless
+             ;; This check is for wdired, not symbolic links, so skip
+             ;; it when make-symbolic-link fails for any reason (like
+             ;; insufficient privileges).
+             (ignore-errors (make-symbolic-link "bar" "foo") t))
             (dired-hide-details-mode)
             (should (memq 'dired-hide-details-link buffer-invisibility-spec))
             (dired-toggle-read-only)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]