Permalink
Browse files

CLJS-2953: stest/with-instrument-disabled prints warning of private use

  • Loading branch information...
mfikes committed Nov 1, 2018
1 parent 6b9a37a commit e78d4fc5b3cead6f4cec447c2daebda6eaa3489c
Showing with 18 additions and 2 deletions.
  1. +6 −2 src/main/cljs/cljs/spec/test/alpha.cljc
  2. +12 −0 src/test/cljs/cljs/spec/test_test.cljs
@@ -46,8 +46,12 @@ returns the set of all symbols naming vars in those nses."
(defmacro with-instrument-disabled
"Disables instrument's checking of calls, within a scope."
[& body]
`(binding [*instrument-enabled* nil]
~@body))
`(let [orig# @#'*instrument-enabled*]
(set! *instrument-enabled* nil)
(try
~@body
(finally
(set! *instrument-enabled* orig#)))))
(defmacro instrument-1
[[quote s] opts]
@@ -97,3 +97,15 @@
(stest/enumerate-namespace 'cljs.spec.test.test-ns1)))
(is (= '#{cljs.spec.test.test-ns2/z}
(stest/enumerate-namespace 'cljs.spec.test.test-ns2))))
(defn fn-2953 [x] ::ret-val)
(s/fdef fn-2953 :args (s/cat :x int?))
(deftest test-cljs-2953
(stest/instrument `fn-2953)
(is @#'stest/*instrument-enabled*)
(is (= ::ret-val (stest/with-instrument-disabled
(is (nil? @#'stest/*instrument-enabled*))
(fn-2953 "abc"))))
(is @#'stest/*instrument-enabled*))

0 comments on commit e78d4fc

Please sign in to comment.