[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 697a7a1: Expand testing of time-stamp format "%y"
From: |
Stephen Gildea |
Subject: |
[Emacs-diffs] master 697a7a1: Expand testing of time-stamp format "%y" |
Date: |
Wed, 9 Oct 2019 12:08:43 -0400 (EDT) |
branch: master
commit 697a7a1497d053d6070432d3a48824e01082ca42
Author: Stephen Gildea <address@hidden>
Commit: Stephen Gildea <address@hidden>
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.
---
test/lisp/time-stamp-tests.el | 38 ++++++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 12 deletions(-)
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index d710564..287b5f4 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 697a7a1: Expand testing of time-stamp format "%y",
Stephen Gildea <=