diff options
| author | Paul Eggert | 2018-09-04 19:14:01 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-09-04 19:15:57 -0700 |
| commit | ccb3891ff5446b578b9306aec0fd9c5ec3ed8e98 (patch) | |
| tree | 888bda0e0584ef78d2a3b25cc6c03b35b6b8ea8e /test | |
| parent | ecb985c10d5241a65ab9552ebfcecaa150b35427 (diff) | |
| download | emacs-ccb3891ff5446b578b9306aec0fd9c5ec3ed8e98.tar.gz emacs-ccb3891ff5446b578b9306aec0fd9c5ec3ed8e98.zip | |
Fix format-time-string bignum bug
The problem can occur on 32-bit platforms with current timestamps.
* src/editfns.c (disassemble_lisp_time, decode_time_components):
Support seconds counts that are bignums.
* test/src/editfns-tests.el (editfns-tests--have-leap-seconds):
New function.
(format-time-string-with-bignum-on-32-bit): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/editfns-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 487f3aaa666..4a840c8d7d1 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -253,6 +253,16 @@ | |||
| 253 | (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" nil | 253 | (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" nil |
| 254 | (concat (make-string 2048 ?X) "0"))))) | 254 | (concat (make-string 2048 ?X) "0"))))) |
| 255 | 255 | ||
| 256 | (defun editfns-tests--have-leap-seconds () | ||
| 257 | (string-equal (format-time-string "%Y-%m-%d %H:%M:%S" 78796800 t) | ||
| 258 | "1972-06-30 23:59:60")) | ||
| 259 | |||
| 260 | (ert-deftest format-time-string-with-bignum-on-32-bit () | ||
| 261 | (should (or (string-equal | ||
| 262 | (format-time-string "%Y-%m-%d %H:%M:%S" (- (ash 1 31) 3600) t) | ||
| 263 | "2038-01-19 02:14:08") | ||
| 264 | (editfns-tests--have-leap-seconds)))) | ||
| 265 | |||
| 256 | (ert-deftest format-with-field () | 266 | (ert-deftest format-with-field () |
| 257 | (should (equal (format "First argument %2$s, then %3$s, then %1$s" 1 2 3) | 267 | (should (equal (format "First argument %2$s, then %3$s, then %1$s" 1 2 3) |
| 258 | "First argument 2, then 3, then 1")) | 268 | "First argument 2, then 3, then 1")) |