[#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
|
(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]
|
(defn macrofy [v]
|
||||||
(with-meta v {:sci/macro true}))
|
(with-meta v {:sci/macro true}))
|
||||||
|
|
@ -20,7 +24,8 @@
|
||||||
'testing-vars-str t/testing-vars-str
|
'testing-vars-str t/testing-vars-str
|
||||||
'testing-contexts-str t/testing-contexts-str
|
'testing-contexts-str t/testing-contexts-str
|
||||||
'inc-report-counter t/inc-report-counter
|
'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
|
'do-report t/do-report
|
||||||
;; assertion utilities
|
;; assertion utilities
|
||||||
'function? t/function?
|
'function? t/function?
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
(ns babashka.test-test
|
(ns babashka.test-test
|
||||||
(:require
|
(:require
|
||||||
[babashka.test-utils :as tu]
|
[babashka.test-utils :as tu]
|
||||||
|
[clojure.java.io :as io]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[clojure.test :as t :refer [deftest is]]
|
[clojure.test :as t :refer [deftest is]]))
|
||||||
[clojure.java.io :as io]))
|
|
||||||
|
|
||||||
(defn bb [& args]
|
(defn bb [& args]
|
||||||
(apply tu/bb nil (map str args)))
|
(apply tu/bb nil (map str args)))
|
||||||
|
|
@ -69,3 +69,6 @@
|
||||||
(deftest assert-expr-test
|
(deftest assert-expr-test
|
||||||
(is (str/includes? (bb (.getPath (io/file "test-resources" "babashka" "assert_expr.clj")))
|
(is (str/includes? (bb (.getPath (io/file "test-resources" "babashka" "assert_expr.clj")))
|
||||||
"3.14 should be roughly 3.141592653589793")))
|
"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