]> git.eshelyaron.com Git - emacs.git/commitdiff
Port time-stamp-test-time-zone to macOS
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Oct 2019 07:15:24 +0000 (00:15 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Oct 2019 07:16:21 +0000 (00:16 -0700)
Problem reported by Stefan Kangas in:
https://lists.gnu.org/r/emacs-devel/2019-10/msg00360.html
* test/lisp/time-stamp-tests.el (time-stamp-test-time-zone):
Don’t assume (format-time-string "%Z" 0 t) returns "GMT".

test/lisp/time-stamp-tests.el

index ace5e58e367bebb0a2b27cc20db51eb793e70684..37822f6e2908c6dff26024eb7a9c4acde1e063cc 100644 (file)
 (ert-deftest time-stamp-test-time-zone ()
   "Test time-stamp formats for time zone."
   (with-time-stamp-test-env
-    ;; implemented and documented since 1995
-    (should (equal (time-stamp-string "%Z" ref-time) "GMT"))
-    ;; documented 1995-2019
-    (should (equal (time-stamp-string "%z" ref-time) "gmt"))
-    ;; implemented since 1997, documented since 2019
-    (should (equal (time-stamp-string "%#Z" ref-time) "gmt"))))
+    (let ((UTC-abbr (format-time-string "%Z" ref-time t))
+         (utc-abbr (format-time-string "%#Z" ref-time t)))
+      ;; implemented and documented since 1995
+      (should (equal (time-stamp-string "%Z" ref-time) UTC-abbr))
+      ;; documented 1995-2019
+      (should (equal (time-stamp-string "%z" ref-time) utc-abbr))
+      ;; implemented since 1997, documented since 2019
+      (should (equal (time-stamp-string "%#Z" ref-time) utc-abbr)))))
 
 (ert-deftest time-stamp-test-non-date-conversions ()
   "Test time-stamp formats for non-date items."