Switch clojure.test/*report-counters* to ref instead of atom

This commit is contained in:
Michiel Borkent 2023-01-21 17:31:53 +01:00
parent 28ec2c690a
commit 77878631e9

View file

@ -316,8 +316,8 @@
Does nothing if *report-counters* is nil." Does nothing if *report-counters* is nil."
{:added "1.1"} {:added "1.1"}
[name] [name]
(when @report-counters (when-let [rc @report-counters]
(swap! @report-counters update-in [name] (fnil inc 0)))) (dosync (commute rc update-in [name] (fnil inc 0)))))
;;; TEST RESULT REPORTING ;;; TEST RESULT REPORTING
@ -758,7 +758,7 @@
*report-counters*." *report-counters*."
{:added "1.1"} {:added "1.1"}
[ctx ns] [ctx ns]
(sci/binding [report-counters (atom @initial-report-counters)] (sci/binding [report-counters (ref @initial-report-counters)]
(let [ns-obj (sci-namespaces/sci-the-ns ctx ns)] (let [ns-obj (sci-namespaces/sci-the-ns ctx ns)]
(do-report {:type :begin-test-ns, :ns ns-obj}) (do-report {:type :begin-test-ns, :ns ns-obj})
;; If the namespace has a test-ns-hook function, call that: ;; If the namespace has a test-ns-hook function, call that:
@ -809,7 +809,7 @@
"Runs the tests for a single Var, with fixtures executed around the test, and summary output after." "Runs the tests for a single Var, with fixtures executed around the test, and summary output after."
{:added "1.11"} {:added "1.11"}
[v] [v]
(sci/binding [report-counters (atom @initial-report-counters)] (sci/binding [report-counters (ref @initial-report-counters)]
(let [ns-obj (-> v meta :ns) (let [ns-obj (-> v meta :ns)
summary (do summary (do
(do-report {:type :begin-test-ns (do-report {:type :begin-test-ns