jolt/test/integration/ports/cljs-port-7-test.janet
Yogthos 16428179fa test: restructure into unit / integration / spec layers + shared harness
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.
2026-06-05 00:00:16 -04:00

20 lines
788 B
Text

(use ../../../src/jolt/api)
(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s)))
(print "=== CLJS Ported Part 7 ===")
(print "32: seq 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 skip")
(assert (= 3 (ct-eval ctx "(let [[_ _ z] [1 2 3]] z)")) "seq destructure end"))
(print " ok")
(print "33: & rest args...")
(let [ctx (init)]
(ct-eval ctx "(defn sum [& xs] (apply + xs))")
(assert (= 6 (ct-eval ctx "(sum 1 2 3)")) "& rest sum")
(ct-eval ctx "(defn first-two [a b & rest] (count rest))")
(assert (= 2 (ct-eval ctx "(first-two 1 2 3 4)")) "& rest after fixed"))
(print " ok")
(print "\nAll CLJS Ported Part 7 tests passed!\n")