Skip to content

Commit 3632023

Browse files
committed
Fix bug where records with deletions are not handled
Fixes #29.
1 parent 5c40ebc commit 3632023

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## Fixed
66

7+
- Fix issue (Fails with records with deleted keys)[https://github.com/lambdaisland/deep-diff2/issues/29]
8+
79
## Changed
810

911
# 2.3.127 (2022-07-01 / a8186a5)

src/lambdaisland/deep_diff2/diff_impl.cljc

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
(fn [[m idx] k]
108108
[(cond-> m
109109
(contains? del idx)
110-
(assoc (->Deletion k) (exp k))
110+
(assoc (->Deletion k) (get exp k))
111111

112112
(not (contains? del idx))
113113
(assoc k (diff (get exp k) (get act k)))

test/lambdaisland/deep_diff2/diff_test.cljc

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@
9696
(is (= {:a (diff/->Mismatch 1 2)}
9797
(diff/diff (map->ARecord {:a 1}) (map->ARecord {:a 2}))))
9898
(is (= {(diff/->Insertion :a) 1}
99-
(diff/diff (map->ARecord {}) (map->ARecord {:a 1}))))))
99+
(diff/diff (map->ARecord {}) (map->ARecord {:a 1}))))
100+
(is (= {(diff/->Deletion :a) 1}
101+
(diff/diff (map->ARecord {:a 1}) (map->ARecord {}))))))
100102

101103
(is (= [{:x (diff/->Mismatch 1 2)}]
102104
(diff/diff [{:x 1}] [{:x 2}])))

0 commit comments

Comments
 (0)