emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 085c7f6 2/2: Test format-time-string with zone arg


From: Paul Eggert
Subject: [Emacs-diffs] master 085c7f6 2/2: Test format-time-string with zone arg
Date: Thu, 27 Apr 2017 18:24:13 -0400 (EDT)

branch: master
commit 085c7f608657d2aa19a6b2b0fe29d3deaa8eb6ff
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 test/src/editfns-tests.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 14124ef..44595be 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -136,4 +136,25 @@
 (ert-deftest format-c-float ()
   (should-error (format "%c" 0.5)))
 
+;;; Check format-time-string with various TZ settings.
+;;; Use only POSIX-compatible TZ values, since the tests should work
+;;; even if tzdb is not in use.
+(ert-deftest format-time-string-with-zone ()
+  (should (string-equal
+           (format-time-string "%Y-%m-%d %H:%M:%S %z" '(0 0 0 0) t)
+           "1970-01-01 00:00:00 +0000"))
+  (should (string-equal
+           (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0) "PST8")
+           "1969-12-31 16:00:00 -0800 (PST)"))
+  (should (string-equal
+           (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0)
+                               "NZST-12NZDT,M9.5.0,M4.1.0/3")
+           "1970-01-01 13:00:00 +1300 (NZDT)")))
+
+;;; This should not dump core.
+(ert-deftest format-time-string-with-outlandish-zone ()
+  (should (stringp
+           (format-time-string "%Y-%m-%d %H:%M:%S %z" '(0 0 0 0)
+                               (concat (make-string 2048 ?X) "0")))))
+
 ;;; editfns-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]