aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/time-stamp-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/time-stamp-tests.el')
-rw-r--r--test/lisp/time-stamp-tests.el23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index ad2cb0ead7f..77cd6c5b945 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -299,18 +299,33 @@
299 (should (equal (time-stamp-string "%w" ref-time2) "5")) 299 (should (equal (time-stamp-string "%w" ref-time2) "5"))
300 (should (equal (time-stamp-string "%w" ref-time3) "0")))) 300 (should (equal (time-stamp-string "%w" ref-time3) "0"))))
301 301
302(ert-deftest time-stamp-test-format-time-zone () 302(ert-deftest time-stamp-test-format-time-zone-name ()
303 "Test time-stamp formats for time zone." 303 "Test time-stamp format %Z."
304 (with-time-stamp-test-env 304 (with-time-stamp-test-env
305 (let ((UTC-abbr (format-time-string "%Z" ref-time1 t)) 305 (let ((UTC-abbr (format-time-string "%Z" ref-time1 t))
306 (utc-abbr (format-time-string "%#Z" ref-time1 t))) 306 (utc-abbr (format-time-string "%#Z" ref-time1 t)))
307 ;; implemented and documented since 1995 307 ;; implemented and documented since 1995
308 (should (equal (time-stamp-string "%Z" ref-time1) UTC-abbr)) 308 (should (equal (time-stamp-string "%Z" ref-time1) UTC-abbr))
309 ;; documented 1995-2019
310 (should (equal (time-stamp-string "%z" ref-time1) utc-abbr))
311 ;; implemented since 1997, documented since 2019 309 ;; implemented since 1997, documented since 2019
312 (should (equal (time-stamp-string "%#Z" ref-time1) utc-abbr))))) 310 (should (equal (time-stamp-string "%#Z" ref-time1) utc-abbr)))))
313 311
312(ert-deftest time-stamp-test-format-time-zone-offset ()
313 "Test time-stamp format %z."
314 (with-time-stamp-test-env
315 ;; documented 1995-2019, will change
316 (should (equal (time-stamp-string "%z" ref-time1)
317 (format-time-string "%#Z" ref-time1 t)))
318 ;; undocumented, changed in 2019
319 (should (equal (time-stamp-string "%:z" ref-time1) "+0000"))
320 (should (equal (time-stamp-string "%:7z" ref-time1) " +0000"))
321 (should (equal (time-stamp-string "%:07z" ref-time1) " +0000"))
322 (let ((time-stamp-time-zone "PST8"))
323 (should (equal (time-stamp-string "%:z" ref-time1) "-0800")))
324 (let ((time-stamp-time-zone "HST10"))
325 (should (equal (time-stamp-string "%:z" ref-time1) "-1000")))
326 (let ((time-stamp-time-zone "CET-1"))
327 (should (equal (time-stamp-string "%:z" ref-time1) "+0100")))))
328
314(ert-deftest time-stamp-test-format-non-date-conversions () 329(ert-deftest time-stamp-test-format-non-date-conversions ()
315 "Test time-stamp formats for non-date items." 330 "Test time-stamp formats for non-date items."
316 (with-time-stamp-test-env 331 (with-time-stamp-test-env