Skip to content

Commit def60a2

Browse files
mfikesswannodette
authored andcommitted
CLJS-1679: Self-host: Incorporate spec tests
Adds cljs.spec-test to the self-host test suite To do so involves some adjustments to self-host loading in this suite (a workaround for CLJS-1657 for some of the spec namespaces) and the need to skip loading code for cljs.core macros namespace. This also catches and fixes one production code issue in the cljs.spec macros namespace: the symbol *instrument-enabled* needs to be qualified so that it refers to the runtime namespace.
1 parent 178c2c0 commit def60a2

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/main/cljs/cljs/spec.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ specified, return speced vars from all namespaces."
342342
(defmacro with-instrument-disabled
343343
"Disables instrument's checking of calls, within a scope."
344344
[& body]
345-
`(binding [*instrument-enabled* nil]
345+
`(binding [cljs.spec/*instrument-enabled* nil]
346346
~@body))
347347

348348
(defmacro keys*

src/test/self/self_parity/test.cljs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@
160160
technical issues)."
161161
[name macros]
162162
((if macros
163-
#{'cljs.pprint
163+
#{'cljs.core
164+
'cljs.pprint
164165
'cljs.env.macros
165166
'cljs.analyzer.macros
166167
'cljs.compiler.macros}
@@ -228,13 +229,23 @@
228229
:verbose false}
229230
cb))
230231

232+
(defn prime-analysis-cache-for-implicit-macro-loading
233+
"Supports priming analysis cache in order to work around
234+
http://dev.clojure.org/jira/browse/CLJS-1657"
235+
[st ns-sym]
236+
(swap! st assoc-in [::cljs.analyzer/namespaces ns-sym :require-macros] {ns-sym ns-sym}))
237+
238+
;; Test suite runner
239+
231240
(defn run-tests
232241
"Runs the tests."
233242
[]
234243
;; Ideally we'd just load test_runner.cljs, but a few namespace tests
235244
;; don't yet run in bootstrapped ClojureScript. These are commented
236245
;; out below and can be uncommented as fixed.
237246
(let [st (cljs/empty-state)]
247+
(prime-analysis-cache-for-implicit-macro-loading st 'cljs.spec)
248+
(prime-analysis-cache-for-implicit-macro-loading st 'cljs.spec.impl.gen)
238249
(eval-form st 'cljs.user
239250
'(ns parity.core
240251
(:require [cljs.test :refer-macros [run-tests]]
@@ -252,7 +263,8 @@
252263
#_[cljs.keyword-test]
253264
[cljs.import-test]
254265
[cljs.ns-test.foo]
255-
#_[cljs.pprint]))
266+
#_[cljs.pprint]
267+
[cljs.spec-test]))
256268
(fn [{:keys [value error]}]
257269
(if error
258270
(prn error)
@@ -272,7 +284,8 @@
272284
'cljs.ns-test.foo
273285
'foo.ns-shadow-test
274286
'cljs.import-test
275-
#_'cljs.pprint)
287+
#_'cljs.pprint
288+
'cljs.spec-test)
276289
(fn [{:keys [value error]}]
277290
(when error
278291
(prn error)))))))))

0 commit comments

Comments
 (0)