summaryrefslogtreecommitdiff
path: root/test/lisp/net/tramp-tests.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-09-24 19:13:34 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-09-24 19:15:23 -0700
commitd0c77a189423dbf648ca5ae9d831a5a2e04e6947 (patch)
tree0c4cf84c21071605699678116a28ebf8eadd2c3d /test/lisp/net/tramp-tests.el
parent19ab7686ae42dcce1e0861bce4713c69a64eec45 (diff)
downloademacs-d0c77a189423dbf648ca5ae9d831a5a2e04e6947.tar.gz
Remove some assumptions about timestamp format
These changes remove some assumptions of Lisp code on timestamp format. Although we’re not going to change the default format any time soon, I went looking for code that was too intimate about details of timestamp format and removed assumptions where this was easy to do with current Emacs primitives. * lisp/ido.el (ido-wash-history): Fix test for zero timestamp. * lisp/time.el (display-time-event-handler): Use time-less-p rather than doing it by hand. (display-time-update): Simplify by using float-time instead of doing the equivalent by hand. * lisp/url/url-auth.el (url-digest-auth-make-cnonce): * test/lisp/calendar/parse-time-tests.el (parse-time-tests): * test/lisp/emacs-lisp/timer-tests.el (timer-test-multiple-of-time): * test/lisp/net/tramp-tests.el: (tramp-test19-directory-files-and-attributes) (tramp-test22-file-times, tramp-test23-visited-file-modtime): Don’t assume detailed format of returned Lisp timestamps.
Diffstat (limited to 'test/lisp/net/tramp-tests.el')
-rw-r--r--test/lisp/net/tramp-tests.el20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 55884f30a7e..79013558fdb 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2882,16 +2882,16 @@ This tests also `file-readable-p', `file-regular-p' and
;; able to return the date correctly. They say "don't know".
(dolist (elt attr)
(unless
- (equal
- (nth
- 5 (file-attributes (expand-file-name (car elt) tmp-name2)))
- '(0 0))
+ (zerop
+ (float-time
+ (nth 5 (file-attributes
+ (expand-file-name (car elt) tmp-name2)))))
(should
(equal (file-attributes (expand-file-name (car elt) tmp-name2))
(cdr elt)))))
(setq attr (directory-files-and-attributes tmp-name2 'full))
(dolist (elt attr)
- (unless (equal (nth 5 (file-attributes (car elt))) '(0 0))
+ (unless (zerop (float-time (nth 5 (file-attributes (car elt)))))
(should
(equal (file-attributes (car elt)) (cdr elt)))))
(setq attr (directory-files-and-attributes tmp-name2 nil "^b"))
@@ -3215,14 +3215,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(write-region "foo" nil tmp-name1)
(should (file-exists-p tmp-name1))
(should (consp (nth 5 (file-attributes tmp-name1))))
- ;; '(0 0) means don't know, and will be replaced by
- ;; `current-time'. Therefore, we use '(0 1). We skip the
+ ;; A zero timestamp means don't know, and will be replaced by
+ ;; `current-time'. Therefore, use timestamp 1. Skip the
;; test, if the remote handler is not able to set the
;; correct time.
(skip-unless (set-file-times tmp-name1 (seconds-to-time 1)))
;; Dumb remote shells without perl(1) or stat(1) are not
;; able to return the date correctly. They say "don't know".
- (unless (equal (nth 5 (file-attributes tmp-name1)) '(0 0))
+ (unless (zerop (float-time (nth 5 (file-attributes tmp-name1))))
(should
(equal (nth 5 (file-attributes tmp-name1)) (seconds-to-time 1)))
(write-region "bla" nil tmp-name2)
@@ -3250,9 +3250,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(with-temp-buffer
(insert-file-contents tmp-name)
(should (verify-visited-file-modtime))
- (set-visited-file-modtime '(0 1))
+ (set-visited-file-modtime (seconds-to-time 1))
(should (verify-visited-file-modtime))
- (should (equal (visited-file-modtime) '(0 1 0 0)))))
+ (should (= 1 (float-time (visited-file-modtime))))))
;; Cleanup.
(ignore-errors (delete-file tmp-name))))))