rcf icon indicating copy to clipboard operation
rcf copied to clipboard

Support for `assert-expr` multimethod

Open darongmean opened this issue 3 years ago • 2 comments

I'm loving this and I want to use it with humane-test-output, https://github.com/pjstadig/humane-test-output. Do you have any guide on how to do it?

darongmean avatar Oct 08 '21 01:10 darongmean

Thank you for giving RCF a shot, and thank you for the warm comment 😊 For now RCF is not compatible with Humane-Test-Output out of the box.

The :fail test reporter is the interesting bit, which pretty prints failed assertions nicely (diffed, formatted, etc…).

This should do the trick:

  1. overload RCF’s default reporter (using defmethod clojure.test/report), like here.
  2. compute the diff (like HTO is doing) inside the reporter
  3. call into HTO’s reporter

This should be doable without having to patch RCF:

(defmethod clojure.test/report :fail [{:keys [expected actual] :as event}]
  (pjstadig.util/report- (assoc event :diffs (compute-diff expected actual))))

But pjstadig.util/report- is defined as private…

A cleaner way would be for RCF to support assert-expr, which would make it compatible with HTO out of the box. I’ll keep this issue open and rename it to track the need of assert-expr.

ggeoffrey avatar Oct 08 '21 08:10 ggeoffrey

The issue is that humane-test-output is meant to self-install on require. For RCF to support this, RCF must be changed to support clojure.test/assert-expr, which is the multimethod hook humane-test-output uses to self-install.

dustingetz avatar Oct 20 '21 11:10 dustingetz