Use numeric time zone suffix in ERT explainer.

This is more robust since the time zone name is system-dependent.

* lisp/emacs-lisp/ert.el (ert--explain-time-equal-p): Use numeric time
zone suffix.

* test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-time-equal-p):
Adapt test.
This commit is contained in:
Philipp Stephani 2025-03-26 03:32:46 +01:00
parent 56248fad53
commit 2d278a0f2e
2 changed files with 4 additions and 4 deletions

View file

@ -676,8 +676,8 @@ A and B are the time values to compare."
(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)
,(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)

View file

@ -796,8 +796,8 @@ This macro is used to test if macroexpansion in `should' works."
(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"
"1970-01-01 00:02:03.000000000+0000"
"1970-01-01 00:02:00.000000000+0000"
difference "3.000000000"))))
(ert-deftest ert-test-stats-set-test-and-result ()