diff options
| author | Philipp Stephani | 2019-04-24 13:17:53 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2019-04-24 13:17:53 +0200 |
| commit | 534c33cf375182c97291d2dd242f936df5953321 (patch) | |
| tree | a36d85bbc81ad93397bd9f81e962274ccb08f7ef /test/src | |
| parent | e290a7d1730c99010272bbff7f497c3041cef46d (diff) | |
| download | emacs-534c33cf375182c97291d2dd242f936df5953321.tar.gz emacs-534c33cf375182c97291d2dd242f936df5953321.zip | |
Fix return type of make_time.
make_time is documented to return a (TICKS . HZ) pair, so we can’t use
make_lisp_time. Introduce a new conversion function instead.
* src/emacs-module.c (module_make_time): Use timespec_to_lisp to
correct return type.
* src/timefns.c (timespec_to_lisp): New function.
(make_lisp_time): Use it.
* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid):
Check return type.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/emacs-module-tests.el | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 78f238140da..9eb38cd4548 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -326,8 +326,12 @@ Interactively, you can try hitting \\[keyboard-quit] to quit." | |||
| 326 | ;; New (TICKS . HZ) format. | 326 | ;; New (TICKS . HZ) format. |
| 327 | '(123456789 . 1000000000))) | 327 | '(123456789 . 1000000000))) |
| 328 | (ert-info ((format "input: %s" input)) | 328 | (ert-info ((format "input: %s" input)) |
| 329 | (should (time-equal-p (mod-test-add-nanosecond input) | 329 | (let ((result (mod-test-add-nanosecond input))) |
| 330 | (time-add input '(0 0 0 1000))))))) | 330 | (should (consp result)) |
| 331 | (should (integerp (car result))) | ||
| 332 | (should (integerp (cdr result))) | ||
| 333 | (should (cl-plusp (cdr result))) | ||
| 334 | (should (time-equal-p result (time-add input '(0 0 0 1000)))))))) | ||
| 331 | 335 | ||
| 332 | (ert-deftest mod-test-add-nanosecond/nil () | 336 | (ert-deftest mod-test-add-nanosecond/nil () |
| 333 | (should (<= (float-time (mod-test-add-nanosecond nil)) | 337 | (should (<= (float-time (mod-test-add-nanosecond nil)) |