aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2018-02-03 00:44:45 -0500
committerNoam Postavsky2018-02-03 14:36:14 -0500
commit9da8da2c4105a28064b1b7d3880ae3fc831c7e8a (patch)
tree39ceb0fa27005fd73c87b963c04ea14991648050
parenta057771a5af5c9f33ab08a1a55676f3b0ddbee74 (diff)
downloademacs-9da8da2c4105a28064b1b7d3880ae3fc831c7e8a.tar.gz
emacs-9da8da2c4105a28064b1b7d3880ae3fc831c7e8a.zip
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'.
-rw-r--r--test/lisp/files-tests.el20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 4e1d20edf05..d07df02877c 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -417,10 +417,23 @@ be invoked with the right arguments."
417 (should (equal (directory-files nospecial-dir) 417 (should (equal (directory-files nospecial-dir)
418 (directory-files tmpdir))))) 418 (directory-files tmpdir)))))
419 419
420(defun files-tests-file-attributes-equal (attr1 attr2)
421 ;; Element 4 is access time, which may be changed by the act of
422 ;; checking the attributes.
423 (setf (nth 4 attr1) nil)
424 (setf (nth 4 attr2) nil)
425 ;; Element 9 is unspecified.
426 (setf (nth 9 attr1) nil)
427 (setf (nth 9 attr2) nil)
428 (equal attr1 attr2))
429
420(ert-deftest files-tests-file-name-non-special-directory-files-and-attributes () 430(ert-deftest files-tests-file-name-non-special-directory-files-and-attributes ()
421 (files-tests--with-temp-non-special (tmpdir nospecial-dir t) 431 (files-tests--with-temp-non-special (tmpdir nospecial-dir t)
422 (should (equal (directory-files-and-attributes nospecial-dir) 432 (cl-loop for (file1 . attr1) in (directory-files-and-attributes nospecial-dir)
423 (directory-files-and-attributes tmpdir))))) 433 for (file2 . attr2) in (directory-files-and-attributes tmpdir)
434 do
435 (should (equal file1 file2))
436 (should (files-tests-file-attributes-equal attr1 attr2)))))
424 437
425(ert-deftest files-tests-file-name-non-special-dired-compress-handler () 438(ert-deftest files-tests-file-name-non-special-dired-compress-handler ()
426 ;; `dired-compress-file' can get confused by filenames with ":" in 439 ;; `dired-compress-file' can get confused by filenames with ":" in
@@ -451,7 +464,8 @@ be invoked with the right arguments."
451 464
452(ert-deftest files-tests-file-name-non-special-file-attributes () 465(ert-deftest files-tests-file-name-non-special-file-attributes ()
453 (files-tests--with-temp-non-special (tmpfile nospecial) 466 (files-tests--with-temp-non-special (tmpfile nospecial)
454 (should (equal (file-attributes nospecial) (file-attributes tmpfile))))) 467 (should (files-tests-file-attributes-equal
468 (file-attributes nospecial) (file-attributes tmpfile)))))
455 469
456(ert-deftest files-tests-file-name-non-special-file-directory-p () 470(ert-deftest files-tests-file-name-non-special-file-directory-p ()
457 (files-tests--with-temp-non-special (tmpdir nospecial-dir t) 471 (files-tests--with-temp-non-special (tmpdir nospecial-dir t)