aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/lisp/time-stamp-tests.el38
1 files changed, 26 insertions, 12 deletions
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index d710564c36d..287b5f486c3 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -248,6 +248,32 @@ In use before 2019 changes; will be used again after those changes settle."
248 (should (equal (time-stamp-string "%S" ref-time) "05")) 248 (should (equal (time-stamp-string "%S" ref-time) "05"))
249 (should (equal (time-stamp-string "%S" ref-time2) "15")))) 249 (should (equal (time-stamp-string "%S" ref-time2) "15"))))
250 250
251(ert-deftest time-stamp-test-year-2digit ()
252 "Test time-stamp formats for %y."
253 (with-time-stamp-test-env
254 ;; implemented and documented since 1995
255 (should (equal (time-stamp-string "%02y" ref-time) "06"))
256 (should (equal (time-stamp-string "%02y" ref-time2) "16"))
257 ;; documented 1997-2019
258 (should (equal (time-stamp-string "%:y" ref-time) "2006"))
259 (should (equal (time-stamp-string "%:y" ref-time2) "2016"))
260 ;; warned 1997-2019, changed in 2019
261 ;; (We don't expect the %-y or %_y form to be useful,
262 ;; but we test both so that we can confidently state that
263 ;; `-' and `_' affect all 2-digit conversions identically.)
264 (should (equal (time-stamp-string "%-y" ref-time) "6"))
265 (should (equal (time-stamp-string "%-y" ref-time2) "16"))
266 (should (equal (time-stamp-string "%_y" ref-time) " 6"))
267 (should (equal (time-stamp-string "%_y" ref-time2) "16"))
268 (should (equal (time-stamp-string "%y" ref-time) "06"))
269 (should (equal (time-stamp-string "%y" ref-time2) "16"))))
270
271(ert-deftest time-stamp-test-year-4digit ()
272 "Test time-stamp format %Y."
273 (with-time-stamp-test-env
274 ;; implemented since 1997, documented since 2019
275 (should (equal (time-stamp-string "%Y" ref-time) "2006"))))
276
251(ert-deftest time-stamp-test-am-pm () 277(ert-deftest time-stamp-test-am-pm ()
252 "Test time-stamp formats for AM and PM strings." 278 "Test time-stamp formats for AM and PM strings."
253 (with-time-stamp-test-env 279 (with-time-stamp-test-env
@@ -267,18 +293,6 @@ In use before 2019 changes; will be used again after those changes settle."
267 (should (equal (time-stamp-string "%w" ref-time2) "5")) 293 (should (equal (time-stamp-string "%w" ref-time2) "5"))
268 (should (equal (time-stamp-string "%w" ref-time3) "0")))) 294 (should (equal (time-stamp-string "%w" ref-time3) "0"))))
269 295
270(ert-deftest time-stamp-test-year ()
271 "Test time-stamp formats for year."
272 (with-time-stamp-test-env
273 ;; implemented and documented since 1995
274 (should (equal (time-stamp-string "%02y" ref-time) "06"))
275 ;; documented 1997-2019
276 (should (equal (time-stamp-string "%:y" ref-time) "2006"))
277 ;; implemented since 1997, documented since 2019
278 (should (equal (time-stamp-string "%Y" ref-time) "2006"))
279 ;; warned 1997-2019, changed in 2019
280 (should (equal (time-stamp-string "%y" ref-time) "06"))))
281
282(ert-deftest time-stamp-test-time-zone () 296(ert-deftest time-stamp-test-time-zone ()
283 "Test time-stamp formats for time zone." 297 "Test time-stamp formats for time zone."
284 (with-time-stamp-test-env 298 (with-time-stamp-test-env