[#482] make clojure.test/report a dynamic var
This commit is contained in:
parent
ee8508d320
commit
d0939de548
2 changed files with 12 additions and 4 deletions
|
|
@ -1,5 +1,9 @@
|
|||
(ns babashka.impl.test
|
||||
(:require [babashka.impl.clojure.test :as t]))
|
||||
(:require [babashka.impl.clojure.test :as t]
|
||||
[sci.core :as sci]
|
||||
#_[sci.impl.namespaces :refer [copy-var]]))
|
||||
|
||||
(def tns (sci/create-ns 'clojure.test nil))
|
||||
|
||||
(defn macrofy [v]
|
||||
(with-meta v {:sci/macro true}))
|
||||
|
|
@ -20,7 +24,8 @@
|
|||
'testing-vars-str t/testing-vars-str
|
||||
'testing-contexts-str t/testing-contexts-str
|
||||
'inc-report-counter t/inc-report-counter
|
||||
'report t/report
|
||||
'report (sci/new-dynamic-var 'report t/report (assoc (meta t/report)
|
||||
:ns tns))
|
||||
'do-report t/do-report
|
||||
;; assertion utilities
|
||||
'function? t/function?
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
(ns babashka.test-test
|
||||
(:require
|
||||
[babashka.test-utils :as tu]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.string :as str]
|
||||
[clojure.test :as t :refer [deftest is]]
|
||||
[clojure.java.io :as io]))
|
||||
[clojure.test :as t :refer [deftest is]]))
|
||||
|
||||
(defn bb [& args]
|
||||
(apply tu/bb nil (map str args)))
|
||||
|
|
@ -69,3 +69,6 @@
|
|||
(deftest assert-expr-test
|
||||
(is (str/includes? (bb (.getPath (io/file "test-resources" "babashka" "assert_expr.clj")))
|
||||
"3.14 should be roughly 3.141592653589793")))
|
||||
|
||||
(deftest rebind-report-test
|
||||
(is (bb "(binding [clojure.test/report (constantly true)] nil)")))
|
||||
|
|
|
|||
Loading…
Reference in a new issue