From: Stephen Gildea Date: Wed, 9 Oct 2019 16:06:23 +0000 (-0700) Subject: Expand testing of time-stamp format "%y" X-Git-Tag: emacs-27.0.90~1186 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=697a7a1497d053d6070432d3a48824e01082ca42;p=emacs.git Expand testing of time-stamp format "%y" * time-stamp-tests.el (time-stamp-test-year): break into two tests, time-stamp-test-year-2digit and time-stamp-test-year-4digit. Expand time-stamp-test-year-2digit to look more like tests for other 2-digit conversions. --- 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." (should (equal (time-stamp-string "%S" ref-time) "05")) (should (equal (time-stamp-string "%S" ref-time2) "15")))) +(ert-deftest time-stamp-test-year-2digit () + "Test time-stamp formats for %y." + (with-time-stamp-test-env + ;; implemented and documented since 1995 + (should (equal (time-stamp-string "%02y" ref-time) "06")) + (should (equal (time-stamp-string "%02y" ref-time2) "16")) + ;; documented 1997-2019 + (should (equal (time-stamp-string "%:y" ref-time) "2006")) + (should (equal (time-stamp-string "%:y" ref-time2) "2016")) + ;; warned 1997-2019, changed in 2019 + ;; (We don't expect the %-y or %_y form to be useful, + ;; but we test both so that we can confidently state that + ;; `-' and `_' affect all 2-digit conversions identically.) + (should (equal (time-stamp-string "%-y" ref-time) "6")) + (should (equal (time-stamp-string "%-y" ref-time2) "16")) + (should (equal (time-stamp-string "%_y" ref-time) " 6")) + (should (equal (time-stamp-string "%_y" ref-time2) "16")) + (should (equal (time-stamp-string "%y" ref-time) "06")) + (should (equal (time-stamp-string "%y" ref-time2) "16")))) + +(ert-deftest time-stamp-test-year-4digit () + "Test time-stamp format %Y." + (with-time-stamp-test-env + ;; implemented since 1997, documented since 2019 + (should (equal (time-stamp-string "%Y" ref-time) "2006")))) + (ert-deftest time-stamp-test-am-pm () "Test time-stamp formats for AM and PM strings." (with-time-stamp-test-env @@ -267,18 +293,6 @@ In use before 2019 changes; will be used again after those changes settle." (should (equal (time-stamp-string "%w" ref-time2) "5")) (should (equal (time-stamp-string "%w" ref-time3) "0")))) -(ert-deftest time-stamp-test-year () - "Test time-stamp formats for year." - (with-time-stamp-test-env - ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%02y" ref-time) "06")) - ;; documented 1997-2019 - (should (equal (time-stamp-string "%:y" ref-time) "2006")) - ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%Y" ref-time) "2006")) - ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%y" ref-time) "06")))) - (ert-deftest time-stamp-test-time-zone () "Test time-stamp formats for time zone." (with-time-stamp-test-env