Hello, I'm trying to use deep-diff2 to print errors to my assertions.
I'm using a submap function to assert that "expected" contains all of "actual".
When the test fail though, I get a huge unreadable message.
I have tried using diff with pretty-print, but it seems to add a lot of breaklines and ends up unreadable as well.
(defn submap?
"Is m1 a subset of m2?"
[m1 m2]
(cond
(and (map? m1) (map? m2)) (every? (fn [[k v]] (and (contains? m2 k)
(submap? v (get m2 k))))
m1)
(and (vector? m1) (vector? m2)) (and (= (count m1) (count m2))
(every? identity (mapv submap? m1 m2)))
:else (= m1 m2)))
(let [actual (build-layout input [])]
(is (submap? expected actual)
(-> (ddiff/diff expected actual)
ddiff/minimize
ddiff/pretty-print)))
What am I doing wrong and how can I fix it?I love deep-diff2, but for this kind of test I really like https://github.com/nubank/matcher-combinators
Do you know how can I print only the diff? (also asked in #matcher-combinators)