aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/editfns-tests.el
diff options
context:
space:
mode:
authorPaul Eggert2017-04-27 15:22:49 -0700
committerPaul Eggert2017-04-27 15:24:07 -0700
commit085c7f608657d2aa19a6b2b0fe29d3deaa8eb6ff (patch)
treed7bdfd6b78bdfffddb869db84e1b11e8f61ba9a4 /test/src/editfns-tests.el
parentabd769131dae3f9693faff9a080267e86936ce99 (diff)
downloademacs-085c7f608657d2aa19a6b2b0fe29d3deaa8eb6ff.tar.gz
emacs-085c7f608657d2aa19a6b2b0fe29d3deaa8eb6ff.zip
Test format-time-string with zone arg
* test/src/editfns-tests.el (format-time-string-with-zone) (format-time-string-with-outlandish-zone): New tests.
Diffstat (limited to 'test/src/editfns-tests.el')
-rw-r--r--test/src/editfns-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 14124ef85fb..44595be3ee2 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -136,4 +136,25 @@
136(ert-deftest format-c-float () 136(ert-deftest format-c-float ()
137 (should-error (format "%c" 0.5))) 137 (should-error (format "%c" 0.5)))
138 138
139;;; Check format-time-string with various TZ settings.
140;;; Use only POSIX-compatible TZ values, since the tests should work
141;;; even if tzdb is not in use.
142(ert-deftest format-time-string-with-zone ()
143 (should (string-equal
144 (format-time-string "%Y-%m-%d %H:%M:%S %z" '(0 0 0 0) t)
145 "1970-01-01 00:00:00 +0000"))
146 (should (string-equal
147 (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0) "PST8")
148 "1969-12-31 16:00:00 -0800 (PST)"))
149 (should (string-equal
150 (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0)
151 "NZST-12NZDT,M9.5.0,M4.1.0/3")
152 "1970-01-01 13:00:00 +1300 (NZDT)")))
153
154;;; This should not dump core.
155(ert-deftest format-time-string-with-outlandish-zone ()
156 (should (stringp
157 (format-time-string "%Y-%m-%d %H:%M:%S %z" '(0 0 0 0)
158 (concat (make-string 2048 ?X) "0")))))
159
139;;; editfns-tests.el ends here 160;;; editfns-tests.el ends here