]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid test failures on w32 systems
authorNoam Postavsky <npostavs@gmail.com>
Fri, 26 Jan 2018 21:42:23 +0000 (16:42 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 26 Jan 2018 21:42:23 +0000 (16:42 -0500)
* test/lisp/files-tests.el
(files-file-name-non-special-dired-compress-handler): New skipped
test, extracted from files-file-name-non-special-handlers.
* test/lisp/files-tests.el (files-file-name-non-special-handlers):
Don't pass nil SWITCHES to `insert-directory', the w32 implementation
doesn't handle it (this is likely a bug, but not the focus of this
test).  Put "$FOO" in the string passed to substitute-in-file-name so
that we actually test "/:" quoting prevents substitution.

test/lisp/files-tests.el

index e90b26041c322d6d0b469fd9ed916502273ccecd..530d2bf62a92cf98b0ede896e480a9e034324a25 100644 (file)
@@ -345,6 +345,19 @@ be invoked with the right arguments."
       (should (file-notify-valid-p watch))
       (file-notify-rm-watch watch))))
 
+(ert-deftest files-file-name-non-special-dired-compress-handler ()
+  ;; `dired-compress-file' can get confused by filenames with ":" in
+  ;; them, which causes this to fail on `windows-nt' systems.  This
+  ;; test does seem to pass on GNU/Linux systems, but it's not clear
+  ;; why since the "/:" quoted file names also have ":" in them.  Just
+  ;; skip for now.
+  (ert-skip "FIXME: dired-compress-file unreliable for names containing `:'." )
+  (files-tests--with-temp-file tmpfile
+    (let* ((nospecial (concat "/:" tmpfile))
+           (compressed (dired-compress-file nospecial)))
+      (when compressed
+        (should (equal nospecial (dired-compress-file compressed)))))))
+
 (ert-deftest files-file-name-non-special-handlers ()
   (files-tests--with-temp-file tmpfile
     (files-tests--with-temp-dir tmpdir
@@ -376,7 +389,6 @@ be invoked with the right arguments."
                        (directory-files tmpdir)))
         (should (equal (directory-files-and-attributes nospecial-dir)
                        (directory-files-and-attributes tmpdir)))
-        (dired-compress-file (dired-compress-file nospecial))
         (dired-uncache nospecial-dir)
         (should (equal (expand-file-name nospecial)
                        nospecial))
@@ -430,10 +442,10 @@ be invoked with the right arguments."
                                (find-backup-file-name tmpfile))))
         (should-not (get-file-buffer nospecial))
         (should (equal (with-temp-buffer
-                         (insert-directory nospecial-dir nil)
+                         (insert-directory nospecial-dir "")
                          (buffer-string))
                        (with-temp-buffer
-                         (insert-directory tmpdir nil)
+                         (insert-directory tmpdir "")
                          (buffer-string))))
         (with-temp-buffer
           (insert-file-contents nospecial)
@@ -505,9 +517,10 @@ be invoked with the right arguments."
               (should (search-forward emacs-version nil t))
               (kill-process proc)
               (accept-process-output proc ))))
-        (let ((process-environment (cons "FOO=foo" process-environment)))
+        (let ((process-environment (cons "FOO=foo" process-environment))
+              (nospecial-foo (concat nospecial "$FOO")))
           ;; The "/:" prevents substitution.
-          (equal (substitute-in-file-name nospecial) nospecial))
+          (equal (substitute-in-file-name nospecial-foo) nospecial-foo))
         (let ((default-directory nospecial-dir))
           (equal (temporary-file-directory) temporary-file-directory))
         (equal (unhandled-file-name-directory nospecial-dir)