clojure.test: assert-expr / do-report / report extension points
jolt's `is` was a fixed macro with no assert-expr multimethod, and the runner bypassed the report multimethod, so libraries couldn't register custom assertions or custom report types (e.g. test.check's ::trial/::shrunk). Add assert-expr (2-arg [msg form], dispatch on the form's first symbol / :default / :always-fail), do-report routing through report, and report :pass/:fail/:error methods that feed the counters. `is` dispatches to an explicitly-registered assert-expr method before its inline path, so thrown?/ thrown-with-msg?/= and every built-in form stay byte-identical. Runtime stdlib only, no re-mint. test/chez/clojure-test.clj self-checks the extension points + full is/are/testing/thrown?/use-fixtures surface; smoke gate runs it.
This commit is contained in:
parent
4a72897dfd
commit
b5ea06c5c2
3 changed files with 102 additions and 0 deletions
|
|
@ -46,5 +46,17 @@ check '(== 3 3.0)' 'true'
|
|||
check_loc '(throw (ex-info "boom" {}))' ' at 1:'
|
||||
check_loc '(do (+ 1 1) (/ 1 0))' ' at 1:'
|
||||
|
||||
# clojure.test extension points (assert-expr / do-report / report) need separate
|
||||
# top-level forms — assert-expr must register before `is` expands — so this is a
|
||||
# multi-form `joltc run`, not an -e one-liner. The file self-checks its tallies.
|
||||
ct_out="$(bin/joltc run test/chez/clojure-test.clj 2>/dev/null)"
|
||||
if printf '%s' "$ct_out" | grep -q 'CLOJURE-TEST OK'; then
|
||||
pass=$((pass + 1))
|
||||
else
|
||||
echo " FAIL: clojure.test extension points"
|
||||
echo " $(printf '%s' "$ct_out" | grep CLOJURE-TEST | tail -1)"
|
||||
fails=$((fails + 1))
|
||||
fi
|
||||
|
||||
echo "cli smoke: $pass passed, $fails failed"
|
||||
[ "$fails" -eq 0 ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue