diff options
author | Stephen Gildea <stepheng+savannah@gildea.com> | 2019-10-09 09:06:23 -0700 |
---|---|---|
committer | Stephen Gildea <stepheng+savannah@gildea.com> | 2019-10-09 09:08:19 -0700 |
commit | 697a7a1497d053d6070432d3a48824e01082ca42 (patch) | |
tree | a67294d96b11beccb5169b70ba4f23148b55f1ae /test | |
parent | 6fa1558ca56c20226821e440a70129ece7b808b6 (diff) | |
download | emacs-697a7a1497d053d6070432d3a48824e01082ca42.tar.gz |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/time-stamp-tests.el | 38 |
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." (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 |