From 77878631e98e02381f2893e5108db9940471a2c1 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 21 Jan 2023 17:31:53 +0100 Subject: [PATCH] Switch clojure.test/*report-counters* to ref instead of atom --- src/babashka/impl/clojure/test.clj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/babashka/impl/clojure/test.clj b/src/babashka/impl/clojure/test.clj index 8903e911..9767aef3 100644 --- a/src/babashka/impl/clojure/test.clj +++ b/src/babashka/impl/clojure/test.clj @@ -316,8 +316,8 @@ Does nothing if *report-counters* is nil." {:added "1.1"} [name] - (when @report-counters - (swap! @report-counters update-in [name] (fnil inc 0)))) + (when-let [rc @report-counters] + (dosync (commute rc update-in [name] (fnil inc 0))))) ;;; TEST RESULT REPORTING @@ -758,7 +758,7 @@ *report-counters*." {:added "1.1"} [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)] (do-report {:type :begin-test-ns, :ns ns-obj}) ;; 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." {:added "1.11"} [v] - (sci/binding [report-counters (atom @initial-report-counters)] + (sci/binding [report-counters (ref @initial-report-counters)] (let [ns-obj (-> v meta :ns) summary (do (do-report {:type :begin-test-ns