- compiler.janet: fix core-pr-str mapping — was pointing to core-str (line 221) - core.janet: add core-pr-str (string/format-based serialization with proper quoting), add core-every-pred (variadic predicate composition), wire both into core-bindings - cljs-port-5.janet: restore var-dynamic? test, with-meta preserves test, add pr-str keyword and every-pred assertions - PLAN.md: update to current state — all phases 0-14 checked off, 316/317 316 ok, 1 fail (pre-existing, unchanged)
22 lines
1,009 B
Text
22 lines
1,009 B
Text
(use ../src/jolt/api)
|
|
(defn ct-eval [ctx s] (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!")
|