-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deep-diff not working for expectations.clojure.test
#435
Comments
Kaocha is "compatible" with expectations because expectations is compatible with clojure.test. It seems in this case they deviate from the clojure.test behavior. I would try running with the |
I think it might actually be an easy fix, try adding this to (defmethod print-expr 'not= [m]
(print-expression m)) |
Thanks for the quick reply. I've taken a look at Expectations diverges from clojure-test here: Lines 241 to 249 in 0fef3a3
The if passes for clojure-test but not for expectations, which fails to satisfy
As a solution, what do you think about adding a new multimethod like this? (defmulti get-actual
(fn [m] (first (:actual m))))
;; e.g. (not= ...)
(defmethod get-actual 'not= [m]
(-> m :actual))
;; e.g. (not (= ...))
(defmethod get-actual :default [m]
(-> m :actual second))
(defn print-expression [m]
(let [printer (output/printer)]
(if (and (not= (:type m) ::one-arg-eql)
(seq? (get-actual m))
(> (count (get-actual m)) 2))
(let [[_ expected & actuals] (get-actual m)]
(output/print-doc I'd be happy to contribute this PR—I'll have some time next week. If that sounds good, can you point me to any development docs you have? |
Go for it! |
This was pretty short so I just submitted the PR. Tests pass locally, but it's failing one that seems unrelated in CI. |
Any advice on the failing workflow? |
I'm getting the
style output when I use kaocha with https://github.com/clojure-expectations/expectations.
Versions:
With regular clojure.test assertions:
Test file:
Output:
With clojure-expectations:
Test file:
Output:
I'm opening an issue as the docs suggest clojure-expectations is supported: https://cljdoc.org/d/lambdaisland/kaocha/1.0.861/doc/1-introduction#1-introduction.
Let me know if there's anything I can do to help debug. Thanks!
The text was updated successfully, but these errors were encountered: