summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-08-19 18:02:59 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-08-19 18:05:15 -0700
commit2197ea89bf5afabc4c52a6499b13e92ae6621554 (patch)
tree642c9ebf5c962305fedf69d4f14b95e3a8d8532d /test/src
parent50dc4ca8d02a466a7236765edf83ae7cfb02d74c (diff)
downloademacs-2197ea89bf5afabc4c52a6499b13e92ae6621554.tar.gz
Fix time-add/time-sub validity checking
* src/timefns.c (time_arith): Check the first arg for validity even if the second arg is not finite. * test/src/timefns-tests.el (time-arith-tests): Test this.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/timefns-tests.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el
index 13ab7d83c3e..a30b2de3a5b 100644
--- a/test/src/timefns-tests.el
+++ b/test/src/timefns-tests.el
@@ -136,6 +136,10 @@
(cons (1+ most-positive-fixnum) 1000000000000)
(cons 1000000000000 (1+ most-positive-fixnum)))))
(dolist (a time-values)
+ (should-error (time-add a 'ouch))
+ (should-error (time-add 'ouch a))
+ (should-error (time-subtract a 'ouch))
+ (should-error (time-subtract 'ouch a))
(dolist (b time-values)
(let ((aa (time-subtract (time-add a b) b)))
(should (or (time-equal-p a aa) (and (floatp aa) (isnan aa)))))