Skip to content

Commit 90497c1

Browse files
committed
CLJS-3351: Self-parity tests fail with tests requiring clojure.test
1 parent 0572fd5 commit 90497c1

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

src/test/self/self_parity/test.cljs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
using a supplied read-file-fn, calling back upon first successful
136136
read, otherwise calling back with nil. Before calling back, first
137137
attempts to read AOT artifacts (JavaScript and cache edn)."
138-
[[filename & more-filenames] read-file-fn cb]
138+
[[filename & more-filenames] macros read-file-fn cb]
139139
(if filename
140140
(read-file-fn
141141
filename
@@ -144,8 +144,9 @@
144144
(let [source-cb-value {:lang (filename->lang filename)
145145
:file filename
146146
:source source}]
147-
(if (or (string/ends-with? filename ".cljs")
148-
(string/ends-with? filename ".cljc"))
147+
(if (and (not macros)
148+
(or (string/ends-with? filename ".cljs")
149+
(string/ends-with? filename ".cljc")))
149150
(read-file-fn
150151
(replace-extension filename ".js")
151152
(fn [javascript-source]
@@ -160,7 +161,7 @@
160161
(cb source-cb-value))))
161162
(cb source-cb-value))))
162163
(cb source-cb-value)))
163-
(read-some more-filenames read-file-fn cb))))
164+
(read-some more-filenames macros read-file-fn cb))))
164165
(cb nil)))
165166

166167
(defn filenames-to-try
@@ -192,17 +193,6 @@
192193
'cljs.tools.reader
193194
'clojure.walk}) name))
194195

195-
;; An atom to keep track of things we've already loaded
196-
(def loaded (atom #{}))
197-
198-
(defn load?
199-
"Determines whether the given namespace should be loaded."
200-
[name macros]
201-
(let [do-not-load (or (@loaded [name macros])
202-
(skip-load? name macros))]
203-
(swap! loaded conj [name macros])
204-
(not do-not-load)))
205-
206196
(defn make-load-fn
207197
"Makes a load function that will read from a sequence of src-paths
208198
using a supplied read-file-fn. It returns a cljs.js-compatible
@@ -212,10 +202,10 @@
212202
with the source of the library (as string)."
213203
[src-paths read-file-fn]
214204
(fn [{:keys [name macros path]} cb]
215-
(if (load? name macros)
205+
(if-not (skip-load? name macros)
216206
(if (re-matches #"^goog/.*" path)
217207
(load-goog name cb)
218-
(read-some (filenames-to-try src-paths macros path) read-file-fn cb))
208+
(read-some (filenames-to-try src-paths macros path) macros read-file-fn cb))
219209
(cb {:source ""
220210
:lang :js}))))
221211

0 commit comments

Comments
 (0)