Skip to content

Commit e78d4fc

Browse files
committed
CLJS-2953: stest/with-instrument-disabled prints warning of private use
1 parent 6b9a37a commit e78d4fc

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/main/cljs/cljs/spec/test/alpha.cljc

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ returns the set of all symbols naming vars in those nses."
4646
(defmacro with-instrument-disabled
4747
"Disables instrument's checking of calls, within a scope."
4848
[& body]
49-
`(binding [*instrument-enabled* nil]
50-
~@body))
49+
`(let [orig# @#'*instrument-enabled*]
50+
(set! *instrument-enabled* nil)
51+
(try
52+
~@body
53+
(finally
54+
(set! *instrument-enabled* orig#)))))
5155

5256
(defmacro instrument-1
5357
[[quote s] opts]

src/test/cljs/cljs/spec/test_test.cljs

+12
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,15 @@
9797
(stest/enumerate-namespace 'cljs.spec.test.test-ns1)))
9898
(is (= '#{cljs.spec.test.test-ns2/z}
9999
(stest/enumerate-namespace 'cljs.spec.test.test-ns2))))
100+
101+
(defn fn-2953 [x] ::ret-val)
102+
103+
(s/fdef fn-2953 :args (s/cat :x int?))
104+
105+
(deftest test-cljs-2953
106+
(stest/instrument `fn-2953)
107+
(is @#'stest/*instrument-enabled*)
108+
(is (= ::ret-val (stest/with-instrument-disabled
109+
(is (nil? @#'stest/*instrument-enabled*))
110+
(fn-2953 "abc"))))
111+
(is @#'stest/*instrument-enabled*))

0 commit comments

Comments
 (0)