emacs-diffs
[Top][All Lists]
Advanced

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

master 43d0fbd: Fix most of fileio-tests on MS-Windows


From: Eli Zaretskii
Subject: master 43d0fbd: Fix most of fileio-tests on MS-Windows
Date: Fri, 28 Aug 2020 02:59:39 -0400 (EDT)

branch: master
commit 43d0fbd270dd34bf3c75354c9bd186df490a4875
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix most of fileio-tests on MS-Windows
    
    * test/src/fileio-tests.el (fileio-tests--HOME-trailing-slash)
    (fileio-tests--expand-file-name-trailing-slash): Account for drive
    letters in MS-Windows/MS-DOS file names.  (Bug#26911)
---
 test/src/fileio-tests.el | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index 8b76912..ba16068 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -111,7 +111,10 @@ Also check that an encoding error can appear in a symlink."
 (ert-deftest fileio-tests--HOME-trailing-slash ()
   "Test that expand-file-name of \"~\" respects trailing slash."
   (let ((old-home (getenv "HOME")))
-    (dolist (home '("/a/b/c" "/a/b/c/"))
+    (dolist (home
+             (if (memq system-type '(windows-nt ms-dos))
+                 '("c:/a/b/c" "c:/a/b/c/")
+               '("/a/b/c" "/a/b/c/")))
       (setenv "HOME" home)
       (should (equal (expand-file-name "~") (expand-file-name home))))
     (setenv "HOME" old-home)))
@@ -119,13 +122,26 @@ Also check that an encoding error can appear in a 
symlink."
 (ert-deftest fileio-tests--expand-file-name-trailing-slash ()
   (dolist (fooslashalias '("foo/" "foo//" "foo/." "foo//." "foo///././."
                            "foo/a/.."))
-    (should (equal (expand-file-name fooslashalias "/") "/foo/"))
-    (should (equal (expand-file-name (concat "/" fooslashalias)) "/foo/")))
-  (should (equal (expand-file-name "." "/usr/spool/") "/usr/spool/"))
-  (should (equal (expand-file-name "" "/usr/spool/") "/usr/spool/"))
+    (if (memq system-type '(windows-nt ms-dos))
+        (progn
+          (should (equal (expand-file-name fooslashalias "c:/") "c:/foo/"))
+          (should (equal (expand-file-name (concat "c:/" fooslashalias))
+                         "c:/foo/"))
+          (should (equal (expand-file-name "." "c:/usr/spool/")
+                         "c:/usr/spool/"))
+          (should (equal (expand-file-name "" "c:/usr/spool/")
+                         "c:/usr/spool/")))
+      (should (equal (expand-file-name fooslashalias "/") "/foo/"))
+      (should (equal (expand-file-name (concat "/" fooslashalias)) "/foo/"))
+      (should (equal (expand-file-name "." "/usr/spool/") "/usr/spool/"))
+      (should (equal (expand-file-name "" "/usr/spool/") "/usr/spool/"))))
   ;; Trailing "B/C/.." means B must be a directory.
-  (should (equal (expand-file-name "/a/b/c/..") "/a/b/"))
-  (should (equal (expand-file-name "/a/b/c/../") "/a/b/")))
+  (if (memq system-type '(windows-nt ms-dos))
+      (progn
+        (should (equal (expand-file-name "c:/a/b/c/..") "c:/a/b/"))
+        (should (equal (expand-file-name "c:/a/b/c/../") "c:/a/b/")))
+    (should (equal (expand-file-name "/a/b/c/..") "/a/b/"))
+    (should (equal (expand-file-name "/a/b/c/../") "/a/b/"))))
 
 (ert-deftest fileio-tests--insert-file-interrupt ()
   (let ((text "-*- coding: binary -*-\n\xc3\xc3help")



reply via email to

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