]> git.eshelyaron.com Git - emacs.git/commitdiff
New time-equal-p test
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 15 Apr 2022 02:03:41 +0000 (19:03 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 15 Apr 2022 02:09:51 +0000 (19:09 -0700)
* test/src/timefns-tests.el (time-equal-p-NaN-NaN): New test.

src/timefns.c
test/src/timefns-tests.el

index 6cfb787af8fab5c3cfd1e306bd99c3d7d419760c..b061be0a786b9a903863e6a58bdfe77ee6f755cf 100644 (file)
@@ -1221,7 +1221,8 @@ time_cmp (Lisp_Object a, Lisp_Object b)
 
   /* Compare nil to nil correctly, and handle other eq values quicker
      while we're at it.  Compare here rather than earlier, to handle
-     NaNs and check formats.  */
+     NaNs.  This means (time-equal-p X X) does not signal an error if
+     X is not a valid time value, but that's OK.  */
   if (EQ (a, b))
     return 0;
 
index 1b49e0622f50ccbbf34725a3af27e7060dbbbe99..e7c464472d025139f69795152c0452edf6d3ea39 100644 (file)
@@ -169,6 +169,10 @@ a fixed place on the right and are padded on the left."
 (ert-deftest time-equal-p-nil-nil ()
   (should (time-equal-p nil nil)))
 
+(ert-deftest time-equal-p-NaN-NaN ()
+  (let ((x 0.0e+NaN))
+    (should (not (time-equal-p x x)))))
+
 (ert-deftest time-arith-tests ()
   (let ((time-values (list 0 -1 1 0.0 -0.0 -1.0 1.0
                           most-negative-fixnum most-positive-fixnum