]> git.eshelyaron.com Git - emacs.git/commitdiff
Use numeric time zone suffix in ERT explainer.
authorPhilipp Stephani <p.stephani2@gmail.com>
Wed, 26 Mar 2025 02:32:46 +0000 (03:32 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 27 Mar 2025 10:12:32 +0000 (11:12 +0100)
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.

(cherry picked from commit 2d278a0f2e945eef30752550f900c1c88367fb6b)

lisp/emacs-lisp/ert.el
test/lisp/emacs-lisp/ert-tests.el

index f2d0a175b55ef594d97fb85eff15e335da4dbdbc..3548b3baf59661e29b29f0c5b06d648f2ea79b42 100644 (file)
@@ -669,8 +669,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)
index 32066d42154fa6ea1f9b6ae00f539ea8e3c39cef..3765bf5f0bbec917191f925957bbfc536dc70510 100644 (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 ()