emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 9da8da2: Don't require all file-attributes to be eq


From: Noam Postavsky
Subject: [Emacs-diffs] master 9da8da2: Don't require all file-attributes to be equal (Bug#30327)
Date: Sat, 3 Feb 2018 14:37:01 -0500 (EST)

branch: master
commit 9da8da2c4105a28064b1b7d3880ae3fc831c7e8a
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Don't require all file-attributes to be equal (Bug#30327)
    
    * test/lisp/files-tests.el (files-tests-file-attributes-equal): New
    function.
    (files-tests-file-name-non-special-directory-files-and-attributes)
    (files-tests-file-name-non-special-file-attributes): Use it instead of
    `equal'.
---
 test/lisp/files-tests.el | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 4e1d20e..d07df02 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -417,10 +417,23 @@ be invoked with the right arguments."
     (should (equal (directory-files nospecial-dir)
                    (directory-files tmpdir)))))
 
+(defun files-tests-file-attributes-equal (attr1 attr2)
+  ;; Element 4 is access time, which may be changed by the act of
+  ;; checking the attributes.
+  (setf (nth 4 attr1) nil)
+  (setf (nth 4 attr2) nil)
+  ;; Element 9 is unspecified.
+  (setf (nth 9 attr1) nil)
+  (setf (nth 9 attr2) nil)
+  (equal attr1 attr2))
+
 (ert-deftest files-tests-file-name-non-special-directory-files-and-attributes 
()
   (files-tests--with-temp-non-special (tmpdir nospecial-dir t)
-    (should (equal (directory-files-and-attributes nospecial-dir)
-                   (directory-files-and-attributes tmpdir)))))
+    (cl-loop for (file1 . attr1) in (directory-files-and-attributes 
nospecial-dir)
+             for (file2 . attr2) in (directory-files-and-attributes tmpdir)
+             do
+             (should (equal file1 file2))
+             (should (files-tests-file-attributes-equal attr1 attr2)))))
 
 (ert-deftest files-tests-file-name-non-special-dired-compress-handler ()
   ;; `dired-compress-file' can get confused by filenames with ":" in
@@ -451,7 +464,8 @@ be invoked with the right arguments."
 
 (ert-deftest files-tests-file-name-non-special-file-attributes ()
   (files-tests--with-temp-non-special (tmpfile nospecial)
-    (should (equal (file-attributes nospecial) (file-attributes tmpfile)))))
+    (should (files-tests-file-attributes-equal
+             (file-attributes nospecial) (file-attributes tmpfile)))))
 
 (ert-deftest files-tests-file-name-non-special-file-directory-p ()
   (files-tests--with-temp-non-special (tmpdir nospecial-dir t)



reply via email to

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