specter/scripts/test-self-host.clj
Jeff Evans 9a34d381f2 Support bootstrap ClojureScript - #72
Adding self-host testing infrastructure and scripts (including tach
plugin)

Incorporating cgrand/macrovich plugin to separate macro definitions from usage in specter.cljc

Changing tests to use :require with :refer-macros to bring in cljs.test macros in cljs mode

Rewriting extend-protocolpath to use extend-protocol, which is available in cljs (extend is not)

Fixing ic-prepare-path implementation to use VarUse even in hosted mode (hardcoding the condition to false)

Various changes in test files to get them working in all three modes

In test, using correct symbol for inc depending on the environment
2020-10-22 14:02:17 -05:00

35 lines
1.4 KiB
Clojure

(require '[cljs.build.api]
'[clojure.java.io :as io])
(cljs.build.api/build "scripts/self-host"
{:main 'com.rpl.specter.self-host.test-runner
:output-to "target/out-self-host/main.js"
:output-dir "target/out-self-host"
:target :nodejs})
(defn copy-source
[filename]
(let [fully-qualified (str "target/out-self-host/" filename)]
(io/make-parents fully-qualified)
(spit fully-qualified
(slurp (io/resource filename)))))
;; Copy some core source files so they can be loaded by self-host tests
(copy-source "cljs/test.cljc")
(copy-source "cljs/analyzer/api.cljc")
(copy-source "clojure/template.clj")
;; Copy all test.check source out of JAR so it can be loaded by self-host tests
;; Note: If test.check adds or renames namespaces, this will need to be updated.
(copy-source "clojure/test/check.cljc")
(copy-source "clojure/test/check/clojure_test.cljc")
(copy-source "clojure/test/check/generators.cljc")
(copy-source "clojure/test/check/impl.cljc")
(copy-source "clojure/test/check/properties.cljc")
(copy-source "clojure/test/check/random/doubles.cljs")
(copy-source "clojure/test/check/random/longs/bit_count_impl.cljs")
(copy-source "clojure/test/check/random/longs.cljs")
(copy-source "clojure/test/check/random.clj")
(copy-source "clojure/test/check/random.cljs")
(copy-source "clojure/test/check/results.cljc")
(copy-source "clojure/test/check/rose_tree.cljc")