summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorStephen Gildea <stepheng+emacs@gildea.com>2019-11-13 20:21:42 -0800
committerStephen Gildea <stepheng+emacs@gildea.com>2019-11-13 21:11:28 -0800
commit1d189843bb2a4f23dc269314d5e6dfb4f9fe801e (patch)
tree8d501f048c8739cd442e827324d947adbe941136 /test/lisp
parent3ecbfefa7239bd071262db25dfc9c97a01ec9ca1 (diff)
downloademacs-1d189843bb2a4f23dc269314d5e6dfb4f9fe801e.tar.gz
emacs-1d189843bb2a4f23dc269314d5e6dfb4f9fe801e.tar.bz2
emacs-1d189843bb2a4f23dc269314d5e6dfb4f9fe801e.zip
time-stamp: update support for time zone numeric offset
* time-stamp.el (time-stamp-string-preprocess): Change new format for numeric time zone from %:z to %5z to match format-time-string better. (time-stamp-format): Document support for numeric time zone. See discussion in bug#32931. * NEWS: Mention time-stamp-format %5z.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/time-stamp-tests.el25
1 files changed, 15 insertions, 10 deletions
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index 77cd6c5b945..ae8eaf467d9 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -312,19 +312,24 @@
(ert-deftest time-stamp-test-format-time-zone-offset ()
"Test time-stamp format %z."
(with-time-stamp-test-env
- ;; documented 1995-2019, will change
- (should (equal (time-stamp-string "%z" ref-time1)
- (format-time-string "%#Z" ref-time1 t)))
- ;; undocumented, changed in 2019
- (should (equal (time-stamp-string "%:z" ref-time1) "+0000"))
- (should (equal (time-stamp-string "%:7z" ref-time1) " +0000"))
- (should (equal (time-stamp-string "%:07z" ref-time1) " +0000"))
+ (let ((utc-abbr (format-time-string "%#Z" ref-time1 t)))
+ ;; documented 1995-2019, warned since 2019, will change
+ (time-stamp-should-warn
+ (equal (time-stamp-string "%z" ref-time1) utc-abbr)))
+ ;; implemented and documented (with compat caveat) since 2019
+ (should (equal (time-stamp-string "%5z" ref-time1) "+0000"))
(let ((time-stamp-time-zone "PST8"))
- (should (equal (time-stamp-string "%:z" ref-time1) "-0800")))
+ (should (equal (time-stamp-string "%5z" ref-time1) "-0800")))
(let ((time-stamp-time-zone "HST10"))
- (should (equal (time-stamp-string "%:z" ref-time1) "-1000")))
+ (should (equal (time-stamp-string "%5z" ref-time1) "-1000")))
(let ((time-stamp-time-zone "CET-1"))
- (should (equal (time-stamp-string "%:z" ref-time1) "+0100")))))
+ (should (equal (time-stamp-string "%5z" ref-time1) "+0100")))
+ ;; implemented since 2019, verify that these don't warn
+ (should (equal (time-stamp-string "%-z" ref-time1) "+00"))
+ (should (equal (time-stamp-string "%_z" ref-time1) "+0000"))
+ (should (equal (time-stamp-string "%:z" ref-time1) "+00:00"))
+ (should (equal (time-stamp-string "%::z" ref-time1) "+00:00:00"))
+ (should (equal (time-stamp-string "%:::z" ref-time1) "+00"))))
(ert-deftest time-stamp-test-format-non-date-conversions ()
"Test time-stamp formats for non-date items."