mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 02:31:03 -08:00
Add an ERT explainer for 'time-equal-p'.
* lisp/emacs-lisp/ert.el (ert--explain-time-equal-p): New explainer function. * test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-time-equal-p): New test.
This commit is contained in:
parent
cf6d0b48d8
commit
8be7e98557
2 changed files with 21 additions and 0 deletions
|
|
@ -669,6 +669,19 @@ Return nil if they are."
|
|||
(put 'equal-including-properties 'ert-explainer
|
||||
'ert--explain-equal-including-properties)
|
||||
|
||||
(defun ert--explain-time-equal-p (a b)
|
||||
"Explainer function for `time-equal-p'.
|
||||
A and B are the time values to compare."
|
||||
(declare (ftype (function (t t) list))
|
||||
(side-effect-free t))
|
||||
(unless (time-equal-p a b)
|
||||
`(different-time-values
|
||||
,(format-time-string "%F %T.%N %Z" a t)
|
||||
,(format-time-string "%F %T.%N %Z" b t)
|
||||
difference
|
||||
,(format-time-string "%s.%N" (time-subtract a b) t))))
|
||||
(function-put #'time-equal-p 'ert-explainer #'ert--explain-time-equal-p)
|
||||
|
||||
;;; Implementation of `ert-info'.
|
||||
|
||||
;; TODO(ohler): The name `info' clashes with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue