(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
'(char 1 "o" (different-properties-for-key a (different-atoms b foo))
context-before "f" context-after "o"))))
+(ert-deftest ert-test-explain-time-equal-p ()
+ (should-not (ert--explain-time-equal-p 123 '(0 123 0 0)))
+ (should (equal (ert--explain-time-equal-p 123 '(0 120 0 0))
+ '(different-time-values
+ "1970-01-01 00:02:03.000000000 UTC"
+ "1970-01-01 00:02:00.000000000 UTC"
+ difference "3.000000000"))))
+
(ert-deftest ert-test-stats-set-test-and-result ()
(let* ((test-1 (make-ert-test :name 'test-1
:body (lambda () nil)))