Hi,
I find the diff hard to read. You probably get used to it, but if there was a easier to understand solution, I would prefer it. From the discussion there seems to be the need to see actual and expected output. From my own experience, I want to very often only what is wrong but not the matches.
I came up with 3 ideas:
Positions to indicate difference:
---------------------------------
I could imagine something like
Expected: [1 3]
Actual: [1 2]
FAIL at (core_test.clj:21)
Expected: (0 1 2 3 4 5 6 7 8 9 10 21 12 13 14 15 16 17 18)
Actual: (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)
(fact {:foo 1 :bar 2} => {:foo 1 :bar 3})
Expected: {:bar 3, :foo 1}
Actual: { :bar 2, :foo 1}
(fact (zipmap (map #(keyword (str "foo" %)) (range 20)) (repeat 1)) => (assoc (zipmap (map #(keyword (str "foo" %)) (range 20)) (repeat 1)) :foo8 2))
Expected: {:foo0 1, :foo1 1, :foo10 1, :foo11 1, :foo12 1, :foo13 1, :foo14 1, :foo15 1, :foo16 1, :foo17 1, :foo18 1, :foo19 1, :foo2 1, :foo3 1, :foo4 1, :foo5 1, :foo6 1, :foo7 1, :foo8 2, :foo9 1}
Actual: {:foo0 1, :foo1 1, :foo10 1, :foo11 1, :foo12 1, :foo13 1, :foo14 1, :foo15 1, :foo16 1, :foo17 1, :foo18 1, :foo19 1, :foo2 1, :foo3 1, :foo4 1, :foo5 1, :foo6 1, :foo7 1, :foo8 1, :foo9 1}
(fact {:foo {:house {:room {:cupboards [{:name "foo" :age 22} {:name "bar" :age 22} {:name "bazz" :age 11} {:name "foo2" :age 22}]}}}}
=> {:foo {:house {:room {:cupboards [{:name "foo" :age 22} {:name "bar" :age 22} {:name "bazz" :age 12} {:name "foo2" :age 22}]}}}})
Expected: {:foo {:house {:room {:cupboards [{:age 22, :name "foo"} {:age 22, :name "bar"} {:age 12, :name "bazz"} {:age 22, :name "foo2"}]}}}}
Actual: {:foo {:house {:room {:cupboards [{:age 22, :name "foo"} {:age 22, :name "bar"} { :age 11, :name "bazz"} {:age 22, :name "foo2"}]}}}}
Underlines
----------
I could imagine something like
Expected: [1 3]
Actual: [1 2]
Delta -
FAIL at (core_test.clj:21)
Expected: (0 1 2 3 4 5 6 7 8 9 10 21 12 13 14 15 16 17 18)
Actual: (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)
Delta -- --
(fact {:foo 1 :bar 2} => {:foo 1 :bar 3})
Expected: {:bar 3, :foo 1}
Actual: {:bar 2, :foo 1}
Delta ------
(fact (zipmap (map #(keyword (str "foo" %)) (range 20)) (repeat 1)) => (assoc (zipmap (map #(keyword (str "foo" %)) (range 20)) (repeat 1)) :foo8 2))
Expected: {:foo0 1, :foo1 1, :foo10 1, :foo11 1, :foo12 1, :foo13 1, :foo14 1, :foo15 1, :foo16 1, :foo17 1, :foo18 1, :foo19 1, :foo2 1, :foo3 1, :foo4 1, :foo5 1, :foo6 1, :foo7 1, :foo8 2, :foo9 1}
Actual: {:foo0 1, :foo1 1, :foo10 1, :foo11 1, :foo12 1, :foo13 1, :foo14 1, :foo15 1, :foo16 1, :foo17 1, :foo18 1, :foo19 1, :foo2 1, :foo3 1, :foo4 1, :foo5 1, :foo6 1, :foo7 1, :foo8 1, :foo9 1}
Delta:
-------
(fact {:foo {:house {:room {:cupboards [{:name "foo" :age 22} {:name "bar" :age 22} {:name "bazz" :age 11} {:name "foo2" :age 22}]}}}}
=> {:foo {:house {:room {:cupboards [{:name "foo" :age 22} {:name "bar" :age 22} {:name "bazz" :age 12} {:name "foo2" :age 22}]}}}})
Expected: {:foo {:house {:room {:cupboards [{:age 22, :name "foo"} {:age 22, :name "bar"} {:age 12, :name "bazz"} {:age 22, :name "foo2"}]}}}}
Actual: {:foo {:house {:room {:cupboards [{:age 22, :name "foo"} {:age 22, :name "bar"} {:age 11, :name "bazz"} {:age 22, :name "foo2"}]}}}}
Delta: --------
Vertical presentation
------------------------
(fact {:foo {:house {:room {:cupboards [{:name "foo" :age 22} {:name "bar" :age 22} {:name "bazz" :age 11} {:name "foo2" :age 22}]}}}}
=> {:foo {:house {:room {:cupboards [{:name "foo" :age 22} {:name "bar" :age 22} {:name "bazz" :age 12} {:name "foo2" :age 22}]}}}})
Expected: Actual:
{:foo {:foo
{:house {:house
{:room {:room
{:cupboards [ {:cupboards [
{:age 22, :name "foo"} {:age 22, :name "foo"}
{:age 22, :name "bar"} {:age 22, :name "bar"}
-> {:age 11, :name "bazz"} {:age 12, :name "bazz"}
{:age 22, :name "foo2"}]}}}} {:age 22, :name "foo2"}]}}}}
Best Regards Sebastian