File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 422422 :else
423423 (let [first-a (first a)
424424 first-b (first b)
425- diff (cmp first-a first-b)]
425+ diff (try
426+ (cmp first-a first-b)
427+ (catch #?(:clj ClassCastException :cljs js/Error) _
428+ :incomparable ))]
426429 (cond
427- (== diff 0 ) (recur only-a only-b (conj both first-a) (next a) (next b))
428- (< diff 0 ) (recur (conj only-a first-a) only-b both (next a) b)
429- (> diff 0 ) (recur only-a (conj only-b first-b) both a (next b)))))))
430+ (= diff :incomparable ) (recur (conj only-a first-a) (conj only-b first-b) both (next a) (next b))
431+ (== diff 0 ) (recur only-a only-b (conj both first-a) (next a) (next b))
432+ (< diff 0 ) (recur (conj only-a first-a) only-b both (next a) b)
433+ (> diff 0 ) (recur only-a (conj only-b first-b) both a (next b)))))))
430434
431435; ; ----------------------------------------------------------------------------
432436
Original file line number Diff line number Diff line change 3434 filtered (ds/filter base (constantly true ))]
3535 (t/is (= (with-out-str (clojure.pprint/pprint base))
3636 (with-out-str (clojure.pprint/pprint filtered)))))))
37+
38+ (deftest ^{:doc " Can't diff databases with different types of the same attribute" }
39+ issue-369
40+ (let [db1 (-> (ds/empty-db )
41+ (ds/db-with [[:db/add 1 :attr :aa ]]))
42+ db2 (-> (ds/empty-db )
43+ (ds/db-with [[:db/add 1 :attr " aa" ]]))]
44+ (t/is (= [[(ds/datom 1 :attr :aa )] [(ds/datom 1 :attr " aa" )] nil ]
45+ (clojure.data/diff db1 db2)))))
You can’t perform that action at this time.
0 commit comments