Skip to content

Commit f2424b6

Browse files
committed
fix instrument and unstrument behavior when handed syntax-quoted forms
1 parent 8524d7b commit f2424b6

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ Returns a collection of syms naming the vars instrumented."
101101
`(instrument '[~@(s/speced-vars)]))
102102
([xs]
103103
`(instrument ~xs nil))
104-
([[quote sym-or-syms] opts]
105-
(let [opts-sym (gensym "opts")]
104+
([sym-or-syms opts]
105+
(let [sym-or-syms (eval sym-or-syms)
106+
opts-sym (gensym "opts")]
106107
`(let [~opts-sym ~opts]
107108
(reduce
108109
(fn [ret# [_# f#]]
@@ -124,18 +125,20 @@ as in instrument. With no args, unstruments all instrumented vars.
124125
Returns a collection of syms naming the vars unstrumented."
125126
([]
126127
`(unstrument '[~@(deref instrumented-vars)]))
127-
([[quote sym-or-syms]]
128-
`(reduce
129-
(fn [ret# f#]
130-
(let [sym# (f#)]
131-
(cond-> ret# sym# (conj sym#))))
132-
[]
133-
[~@(->> (collectionize sym-or-syms)
134-
(map
135-
(fn [sym]
136-
(when (symbol? sym)
137-
`(fn [] (unstrument-1 '~sym)))))
138-
(remove nil?))])))
128+
([sym-or-syms]
129+
(let [sym-or-syms (eval sym-or-syms)]
130+
`(reduce
131+
(fn [ret# f#]
132+
(let [sym# (f#)]
133+
(cond-> ret# sym# (conj sym#))))
134+
[]
135+
[~@(->> (collectionize sym-or-syms)
136+
(map
137+
(fn [sym]
138+
(when (symbol? sym)
139+
`(fn []
140+
(unstrument-1 '~sym)))))
141+
(remove nil?))]))))
139142

140143
;(defmacro run-tests
141144
; "Like run-all-tests, but scoped to specific namespaces, or to

0 commit comments

Comments
 (0)