diff options
| author | Stephen Gildea | 2019-11-13 20:21:42 -0800 |
|---|---|---|
| committer | Stephen Gildea | 2019-11-13 21:11:28 -0800 |
| commit | 1d189843bb2a4f23dc269314d5e6dfb4f9fe801e (patch) | |
| tree | 8d501f048c8739cd442e827324d947adbe941136 /test | |
| parent | 3ecbfefa7239bd071262db25dfc9c97a01ec9ca1 (diff) | |
| download | emacs-1d189843bb2a4f23dc269314d5e6dfb4f9fe801e.tar.gz 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')
| -rw-r--r-- | test/lisp/time-stamp-tests.el | 25 |
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 @@ | |||
| 312 | (ert-deftest time-stamp-test-format-time-zone-offset () | 312 | (ert-deftest time-stamp-test-format-time-zone-offset () |
| 313 | "Test time-stamp format %z." | 313 | "Test time-stamp format %z." |
| 314 | (with-time-stamp-test-env | 314 | (with-time-stamp-test-env |
| 315 | ;; documented 1995-2019, will change | 315 | (let ((utc-abbr (format-time-string "%#Z" ref-time1 t))) |
| 316 | (should (equal (time-stamp-string "%z" ref-time1) | 316 | ;; documented 1995-2019, warned since 2019, will change |
| 317 | (format-time-string "%#Z" ref-time1 t))) | 317 | (time-stamp-should-warn |
| 318 | ;; undocumented, changed in 2019 | 318 | (equal (time-stamp-string "%z" ref-time1) utc-abbr))) |
| 319 | (should (equal (time-stamp-string "%:z" ref-time1) "+0000")) | 319 | ;; implemented and documented (with compat caveat) since 2019 |
| 320 | (should (equal (time-stamp-string "%:7z" ref-time1) " +0000")) | 320 | (should (equal (time-stamp-string "%5z" ref-time1) "+0000")) |
| 321 | (should (equal (time-stamp-string "%:07z" ref-time1) " +0000")) | ||
| 322 | (let ((time-stamp-time-zone "PST8")) | 321 | (let ((time-stamp-time-zone "PST8")) |
| 323 | (should (equal (time-stamp-string "%:z" ref-time1) "-0800"))) | 322 | (should (equal (time-stamp-string "%5z" ref-time1) "-0800"))) |
| 324 | (let ((time-stamp-time-zone "HST10")) | 323 | (let ((time-stamp-time-zone "HST10")) |
| 325 | (should (equal (time-stamp-string "%:z" ref-time1) "-1000"))) | 324 | (should (equal (time-stamp-string "%5z" ref-time1) "-1000"))) |
| 326 | (let ((time-stamp-time-zone "CET-1")) | 325 | (let ((time-stamp-time-zone "CET-1")) |
| 327 | (should (equal (time-stamp-string "%:z" ref-time1) "+0100"))))) | 326 | (should (equal (time-stamp-string "%5z" ref-time1) "+0100"))) |
| 327 | ;; implemented since 2019, verify that these don't warn | ||
| 328 | (should (equal (time-stamp-string "%-z" ref-time1) "+00")) | ||
| 329 | (should (equal (time-stamp-string "%_z" ref-time1) "+0000")) | ||
| 330 | (should (equal (time-stamp-string "%:z" ref-time1) "+00:00")) | ||
| 331 | (should (equal (time-stamp-string "%::z" ref-time1) "+00:00:00")) | ||
| 332 | (should (equal (time-stamp-string "%:::z" ref-time1) "+00")))) | ||
| 328 | 333 | ||
| 329 | (ert-deftest time-stamp-test-format-non-date-conversions () | 334 | (ert-deftest time-stamp-test-format-non-date-conversions () |
| 330 | "Test time-stamp formats for non-date items." | 335 | "Test time-stamp formats for non-date items." |