Reorganize the flat 49-file test/ into three layers (jpm test recurses, so all
are still discovered):
- test/unit/ white-box component tests (reader, evaluator, types,
persistent-map, lazy-seq, macro, interop, compiler)
- test/integration/ cross-cutting + regression batteries (conformance, jank,
sci-bootstrap/runtime, features, systematic-coverage, api,
core, namespaces, ported clojure suites) and
.../ports/ ported clojure/cljs test batches pending consolidation
- test/spec/ the behavioral contract (built out in following commits)
- test/support/harness.janet shared defspec table runner (cases compared via
Jolt's own =, with a :throws sentinel) + expect= helpers
Files moved with git mv (history preserved) and import paths fixed for depth.
jpm test green. README Test section updated.
Next: build out test/spec/ to cover the public API area-by-area, mining the
integration batteries and filling gaps.
22 lines
1 KiB
Text
22 lines
1 KiB
Text
(use ../../../src/jolt/api)
|
|
(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s)))
|
|
(print "=== CLJS Ported Part 5 ===")
|
|
(print "22: destructuring...")
|
|
(let [ctx (init)]
|
|
(assert (= 1 (ct-eval ctx "(let [[x] [1 2 3]] x)")) "seq destructure")
|
|
(assert (= 2 (ct-eval ctx "(let [[_ y] [1 2 3]] y)")) "seq destructure rest"))
|
|
(print " ok")
|
|
(print "23: metadata...")
|
|
(let [ctx (init)]
|
|
(ct-eval ctx "(def ^:dynamic *dyn* 42)")
|
|
(assert (= true (ct-eval ctx "(var-dynamic? (var *dyn*))")) "dynamic metadata")
|
|
(assert (= 1 (ct-eval ctx "(:a (with-meta {:a 1} {:c 3}))")) "with-meta preserves"))
|
|
(print " ok")
|
|
(print "24: function composition...")
|
|
(let [ctx (init)]
|
|
(assert (= true (ct-eval ctx "((complement odd?) 2)")) "complement")
|
|
(assert (= 5 (ct-eval ctx "((constantly 5) :anything)")) "constantly")
|
|
(assert (= true (ct-eval ctx "((every-pred number? even?) 4)")) "every-pred")
|
|
(assert (= ":hello" (ct-eval ctx "(pr-str :hello)")) "pr-str keyword"))
|
|
(print " ok")
|
|
(print "\nAll CLJS Ported Part 5 tests passed!")
|