Skip to content

Commit 5d3b97b

Browse files
committed
Check for NaNs in Clojure, too.
Occasionally the round-trip-diff test would fail in Clojure because we weren't checking for NaNs in Clojure.
1 parent 3463a3d commit 5d3b97b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/lambdaisland/deep_diff2/diff_test.cljc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@
199199
;; (not= ##NaN ##NaN), which messes up test results
200200
;; https://stackoverflow.com/questions/16983955/check-for-nan-in-clojurescript
201201
(defn NaN? [node]
202-
#?(:clj false
202+
;; Need to confirm that it's a Double first.
203+
#?(:clj (and (instance? Double node) (Double/isNaN node))
203204
:cljs
204205
(and (= (.call js/toString node) (str "[object Number]"))
205206
(js/eval (str node " != +" node )))))

0 commit comments

Comments
 (0)