File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,12 +56,16 @@ returns the set of all symbols naming vars in those nses."
5656(defmacro instrument-1
5757 [[quote s] opts]
5858 (when-let [v (ana-api/resolve &env s)]
59- (when (and (nil? (:const v))
60- #?(:cljs (nil? (:macro v))))
61- (swap! instrumented-vars conj (:name v))
62- `(let [checked# (#'instrument-1* '~s (var ~s) ~opts)]
63- (when checked# (set! ~s checked#))
64- '~(:name v)))))
59+ (let [var-name (:name v)]
60+ (when (and (nil? (:const v))
61+ #?(:cljs (nil? (:macro v)))
62+ (contains? #?(:clj (s/speced-vars )
63+ :cljs (cljs.spec.alpha$macros/speced-vars ))
64+ var-name))
65+ (swap! instrumented-vars conj var-name)
66+ `(let [checked# (#'instrument-1* '~s (var ~s) ~opts)]
67+ (when checked# (set! ~s checked#))
68+ '~var-name)))))
6569
6670(defmacro unstrument-1
6771 [[quote s]]
Original file line number Diff line number Diff line change 11(ns cljs.spec.test-test
22 (:require-macros [cljs.spec.test.test-macros])
3- (:require [cljs.test :as test :refer-macros [deftest is are run-tests]]
3+ (:require [cljs.test :as test :refer-macros [deftest testing
4+ is are run-tests]]
45 [cljs.spec.alpha :as s]
56 [cljs.spec.test.alpha :as stest]
67 [cljs.spec.test.test-ns1]
109110 (is (nil? @#'stest/*instrument-enabled*))
110111 (fn-2953 " abc" ))))
111112 (is @#'stest/*instrument-enabled*))
113+
114+ (defn fn-2975 [x])
115+
116+ (deftest test-2975
117+ (testing " instrument and unstrument return empty coll when no fdef exists"
118+ (is (empty? (stest/instrument `fn-2975)))
119+ (is (empty? (stest/unstrument `fn-2975)))))
You can’t perform that action at this time.
0 commit comments