aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/time-stamp-tests.el42
1 files changed, 23 insertions, 19 deletions
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index 452d83ddba9..f13fee76f0e 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -63,9 +63,10 @@
63 ;; implemented and documented since 1997 63 ;; implemented and documented since 1997
64 (should (equal (time-stamp-string "%3a" ref-time) "Mon")) 64 (should (equal (time-stamp-string "%3a" ref-time) "Mon"))
65 (should (equal (time-stamp-string "%#A" ref-time) "MONDAY")) 65 (should (equal (time-stamp-string "%#A" ref-time) "MONDAY"))
66 ;; documented 1997-2019
66 (should (equal (time-stamp-string "%3A" ref-time) "MON")) 67 (should (equal (time-stamp-string "%3A" ref-time) "MON"))
67 (should (equal (time-stamp-string "%:a" ref-time) "Monday")) 68 (should (equal (time-stamp-string "%:a" ref-time) "Monday"))
68 ;; implemented since 2001, undocumented future formats 69 ;; implemented since 2001, documented since 2019
69 (should (equal (time-stamp-string "%#a" ref-time) "MON")) 70 (should (equal (time-stamp-string "%#a" ref-time) "MON"))
70 (should (equal (time-stamp-string "%:A" ref-time) "Monday")) 71 (should (equal (time-stamp-string "%:A" ref-time) "Monday"))
71 ;; warned since 1997, will change 72 ;; warned since 1997, will change
@@ -82,9 +83,10 @@
82 ;; implemented and documented since 1997 83 ;; implemented and documented since 1997
83 (should (equal (time-stamp-string "%3b" ref-time) "Jan")) 84 (should (equal (time-stamp-string "%3b" ref-time) "Jan"))
84 (should (equal (time-stamp-string "%#B" ref-time) "JANUARY")) 85 (should (equal (time-stamp-string "%#B" ref-time) "JANUARY"))
86 ;; documented 1997-2019
85 (should (equal (time-stamp-string "%3B" ref-time) "JAN")) 87 (should (equal (time-stamp-string "%3B" ref-time) "JAN"))
86 (should (equal (time-stamp-string "%:b" ref-time) "January")) 88 (should (equal (time-stamp-string "%:b" ref-time) "January"))
87 ;; implemented since 2001, undocumented future formats 89 ;; implemented since 2001, documented since 2019
88 (should (equal (time-stamp-string "%#b" ref-time) "JAN")) 90 (should (equal (time-stamp-string "%#b" ref-time) "JAN"))
89 (should (equal (time-stamp-string "%:B" ref-time) "January")) 91 (should (equal (time-stamp-string "%:B" ref-time) "January"))
90 ;; warned since 1997, will change 92 ;; warned since 1997, will change
@@ -103,10 +105,10 @@
103 (should (equal (time-stamp-string "%2d" ref-time2) "18")) 105 (should (equal (time-stamp-string "%2d" ref-time2) "18"))
104 (should (equal (time-stamp-string "%02d" ref-time) "02")) 106 (should (equal (time-stamp-string "%02d" ref-time) "02"))
105 (should (equal (time-stamp-string "%02d" ref-time2) "18")) 107 (should (equal (time-stamp-string "%02d" ref-time2) "18"))
106 ;; implemented and documented since 1997 108 ;; documented 1997-2019
107 (should (equal (time-stamp-string "%:d" ref-time) "2")) 109 (should (equal (time-stamp-string "%:d" ref-time) "2"))
108 (should (equal (time-stamp-string "%:d" ref-time2) "18")) 110 (should (equal (time-stamp-string "%:d" ref-time2) "18"))
109 ;; implemented since 1997, undocumented future format 111 ;; implemented since 1997, documented since 2019
110 (should (equal (time-stamp-string "%1d" ref-time) "2")) 112 (should (equal (time-stamp-string "%1d" ref-time) "2"))
111 (should (equal (time-stamp-string "%1d" ref-time2) "18")) 113 (should (equal (time-stamp-string "%1d" ref-time2) "18"))
112 ;; warned since 1997, will change 114 ;; warned since 1997, will change
@@ -125,11 +127,11 @@
125 (should (equal (time-stamp-string "%02H" ref-time) "15")) 127 (should (equal (time-stamp-string "%02H" ref-time) "15"))
126 (should (equal (time-stamp-string "%02H" ref-time2) "12")) 128 (should (equal (time-stamp-string "%02H" ref-time2) "12"))
127 (should (equal (time-stamp-string "%02H" ref-time3) "06")) 129 (should (equal (time-stamp-string "%02H" ref-time3) "06"))
128 ;; implemented and documented since 1997 130 ;; documented 1997-2019
129 (should (equal (time-stamp-string "%:H" ref-time) "15")) 131 (should (equal (time-stamp-string "%:H" ref-time) "15"))
130 (should (equal (time-stamp-string "%:H" ref-time2) "12")) 132 (should (equal (time-stamp-string "%:H" ref-time2) "12"))
131 (should (equal (time-stamp-string "%:H" ref-time3) "6")) 133 (should (equal (time-stamp-string "%:H" ref-time3) "6"))
132 ;; implemented since 1997, undocumented future format 134 ;; implemented since 1997, documented since 2019
133 (should (equal (time-stamp-string "%1H" ref-time) "15")) 135 (should (equal (time-stamp-string "%1H" ref-time) "15"))
134 (should (equal (time-stamp-string "%1H" ref-time2) "12")) 136 (should (equal (time-stamp-string "%1H" ref-time2) "12"))
135 (should (equal (time-stamp-string "%1H" ref-time3) "6")) 137 (should (equal (time-stamp-string "%1H" ref-time3) "6"))
@@ -151,11 +153,11 @@
151 (should (equal (time-stamp-string "%02I" ref-time) "03")) 153 (should (equal (time-stamp-string "%02I" ref-time) "03"))
152 (should (equal (time-stamp-string "%02I" ref-time2) "12")) 154 (should (equal (time-stamp-string "%02I" ref-time2) "12"))
153 (should (equal (time-stamp-string "%02I" ref-time3) "06")) 155 (should (equal (time-stamp-string "%02I" ref-time3) "06"))
154 ;; implemented and documented since 1997 156 ;; documented 1997-2019
155 (should (equal (time-stamp-string "%:I" ref-time) "3")) ;PM 157 (should (equal (time-stamp-string "%:I" ref-time) "3")) ;PM
156 (should (equal (time-stamp-string "%:I" ref-time2) "12")) ;PM 158 (should (equal (time-stamp-string "%:I" ref-time2) "12")) ;PM
157 (should (equal (time-stamp-string "%:I" ref-time3) "6")) ;AM 159 (should (equal (time-stamp-string "%:I" ref-time3) "6")) ;AM
158 ;; implemented since 1997, undocumented future format 160 ;; implemented since 1997, documented since 2019
159 (should (equal (time-stamp-string "%1I" ref-time) "3")) 161 (should (equal (time-stamp-string "%1I" ref-time) "3"))
160 (should (equal (time-stamp-string "%1I" ref-time2) "12")) 162 (should (equal (time-stamp-string "%1I" ref-time2) "12"))
161 (should (equal (time-stamp-string "%1I" ref-time3) "6")) 163 (should (equal (time-stamp-string "%1I" ref-time3) "6"))
@@ -175,10 +177,10 @@
175 (should (equal (time-stamp-string "%2m" ref-time2) "11")) 177 (should (equal (time-stamp-string "%2m" ref-time2) "11"))
176 (should (equal (time-stamp-string "%02m" ref-time) "01")) 178 (should (equal (time-stamp-string "%02m" ref-time) "01"))
177 (should (equal (time-stamp-string "%02m" ref-time2) "11")) 179 (should (equal (time-stamp-string "%02m" ref-time2) "11"))
178 ;; implemented and documented since 1997 180 ;; documented 1997-2019
179 (should (equal (time-stamp-string "%:m" ref-time) "1")) 181 (should (equal (time-stamp-string "%:m" ref-time) "1"))
180 (should (equal (time-stamp-string "%:m" ref-time2) "11")) 182 (should (equal (time-stamp-string "%:m" ref-time2) "11"))
181 ;; implemented since 1997, undocumented future format 183 ;; implemented since 1997, documented since 2019
182 (should (equal (time-stamp-string "%1m" ref-time) "1")) 184 (should (equal (time-stamp-string "%1m" ref-time) "1"))
183 (should (equal (time-stamp-string "%1m" ref-time2) "11")) 185 (should (equal (time-stamp-string "%1m" ref-time2) "11"))
184 ;; warned since 1997, will change 186 ;; warned since 1997, will change
@@ -195,10 +197,10 @@
195 (should (equal (time-stamp-string "%2M" ref-time2) "14")) 197 (should (equal (time-stamp-string "%2M" ref-time2) "14"))
196 (should (equal (time-stamp-string "%02M" ref-time) "04")) 198 (should (equal (time-stamp-string "%02M" ref-time) "04"))
197 (should (equal (time-stamp-string "%02M" ref-time2) "14")) 199 (should (equal (time-stamp-string "%02M" ref-time2) "14"))
198 ;; implemented and documented since 1997 200 ;; documented 1997-2019
199 (should (equal (time-stamp-string "%:M" ref-time) "4")) 201 (should (equal (time-stamp-string "%:M" ref-time) "4"))
200 (should (equal (time-stamp-string "%:M" ref-time2) "14")) 202 (should (equal (time-stamp-string "%:M" ref-time2) "14"))
201 ;; implemented since 1997, undocumented future format 203 ;; implemented since 1997, documented since 2019
202 (should (equal (time-stamp-string "%1M" ref-time) "4")) 204 (should (equal (time-stamp-string "%1M" ref-time) "4"))
203 (should (equal (time-stamp-string "%1M" ref-time2) "14")) 205 (should (equal (time-stamp-string "%1M" ref-time2) "14"))
204 ;; warned since 1997, will change 206 ;; warned since 1997, will change
@@ -215,10 +217,10 @@
215 (should (equal (time-stamp-string "%2S" ref-time2) "15")) 217 (should (equal (time-stamp-string "%2S" ref-time2) "15"))
216 (should (equal (time-stamp-string "%02S" ref-time) "05")) 218 (should (equal (time-stamp-string "%02S" ref-time) "05"))
217 (should (equal (time-stamp-string "%02S" ref-time2) "15")) 219 (should (equal (time-stamp-string "%02S" ref-time2) "15"))
218 ;; implemented and documented since 1997 220 ;; documented 1997-2019
219 (should (equal (time-stamp-string "%:S" ref-time) "5")) 221 (should (equal (time-stamp-string "%:S" ref-time) "5"))
220 (should (equal (time-stamp-string "%:S" ref-time2) "15")) 222 (should (equal (time-stamp-string "%:S" ref-time2) "15"))
221 ;; implemented since 1997, undocumented future format 223 ;; implemented since 1997, documented since 2019
222 (should (equal (time-stamp-string "%1S" ref-time) "5")) 224 (should (equal (time-stamp-string "%1S" ref-time) "5"))
223 (should (equal (time-stamp-string "%1S" ref-time2) "15")) 225 (should (equal (time-stamp-string "%1S" ref-time2) "15"))
224 ;; warned since 1997, will change 226 ;; warned since 1997, will change
@@ -251,9 +253,9 @@
251 (with-time-stamp-test-env 253 (with-time-stamp-test-env
252 ;; implemented and documented since 1995 254 ;; implemented and documented since 1995
253 (should (equal (time-stamp-string "%02y" ref-time) "06")) 255 (should (equal (time-stamp-string "%02y" ref-time) "06"))
254 ;; implemented and documented since 1997 256 ;; documented 1997-2019
255 (should (equal (time-stamp-string "%:y" ref-time) "2006")) 257 (should (equal (time-stamp-string "%:y" ref-time) "2006"))
256 ;; implemented since 1997, undocumented future format 258 ;; implemented since 1997, documented since 2019
257 (should (equal (time-stamp-string "%Y" ref-time) "2006")) 259 (should (equal (time-stamp-string "%Y" ref-time) "2006"))
258 ;; warned since 1997, will change 260 ;; warned since 1997, will change
259 (time-stamp-should-warn (equal (time-stamp-string "%y" ref-time) "2006")))) 261 (time-stamp-should-warn (equal (time-stamp-string "%y" ref-time) "2006"))))
@@ -263,8 +265,9 @@
263 (with-time-stamp-test-env 265 (with-time-stamp-test-env
264 ;; implemented and documented since 1995 266 ;; implemented and documented since 1995
265 (should (equal (time-stamp-string "%Z" ref-time) "GMT")) 267 (should (equal (time-stamp-string "%Z" ref-time) "GMT"))
268 ;; documented 1995-2019
266 (should (equal (time-stamp-string "%z" ref-time) "gmt")) 269 (should (equal (time-stamp-string "%z" ref-time) "gmt"))
267 ;; implemented since 1997, undocumented future format 270 ;; implemented since 1997, documented since 2019
268 (should (equal (time-stamp-string "%#Z" ref-time) "gmt")))) 271 (should (equal (time-stamp-string "%#Z" ref-time) "gmt"))))
269 272
270(ert-deftest time-stamp-test-non-date-conversions () 273(ert-deftest time-stamp-test-non-date-conversions ()
@@ -277,14 +280,15 @@
277 (should (equal 280 (should (equal
278 (time-stamp-string "%F" ref-time) "/emacs/test/time-stamped-file")) 281 (time-stamp-string "%F" ref-time) "/emacs/test/time-stamped-file"))
279 (should (equal (time-stamp-string "%h" ref-time) "test-mail-host-name")) 282 (should (equal (time-stamp-string "%h" ref-time) "test-mail-host-name"))
283 ;; documented 1995-2019
280 (should (equal 284 (should (equal
281 (time-stamp-string "%s" ref-time) "test-system-name.example.org")) 285 (time-stamp-string "%s" ref-time) "test-system-name.example.org"))
282 (should (equal (time-stamp-string "%U" ref-time) "Time Stamp Tester")) 286 (should (equal (time-stamp-string "%U" ref-time) "Time Stamp Tester"))
283 (should (equal (time-stamp-string "%u" ref-time) "test-logname")) 287 (should (equal (time-stamp-string "%u" ref-time) "test-logname"))
284 ;; implemented since 2001, undocumented future formats 288 ;; implemented since 2001, documented since 2019
285 (should (equal (time-stamp-string "%L" ref-time) "Time Stamp Tester")) 289 (should (equal (time-stamp-string "%L" ref-time) "Time Stamp Tester"))
286 (should (equal (time-stamp-string "%l" ref-time) "test-logname")) 290 (should (equal (time-stamp-string "%l" ref-time) "test-logname"))
287 ;; implemented since 2007, undocumented future formats 291 ;; implemented since 2007, documented since 2019
288 (should (equal 292 (should (equal
289 (time-stamp-string "%Q" ref-time) "test-system-name.example.org")) 293 (time-stamp-string "%Q" ref-time) "test-system-name.example.org"))
290 (should (equal 294 (should (equal