jolt/test/cljs-port-6.janet
Yogthos 0e08f65016 Phases 15-16: SCI bootstrap, Janet interop, eval, lazy-cat, CLJS ported tests
- SCI bootstrap complete: all 9 SCI source files load (317 forms, 0 failures)
- prefer-method/remove-method/remove-all-methods promoted to special forms
- eval special form (interpreter + compiler) with eval-test.janet
- lazy-cat macro with structural equality tests in lazy-test.janet
- Janet-native interop via . special form on tables/structs:
  field access (. obj :key), method calls (. obj method args...)
  fn* form compilation support, .- reader sugar
  interop-test.janet with 7 test sections (14 assertions)
- New core bindings: with-meta, var-dynamic?, load-string
- ^:dynamic def handler, core-str nil handling, core-meta for with-meta
- 7 new CLJS ported test files: cljs-port-6 through -10, cljs-core-test, cljs-collections-test
- test-sci-runtime.janet verifies SCI namespaces/types/Var/IBox/IVar
- 317/317 tests pass, 0 failing scripts, 440+ assertions across 31 test files
- README updated with Janet interop documentation
2026-06-03 23:44:49 -04:00

30 lines
990 B
Text

(use ../src/jolt/api)
(defn ct-eval [ctx s] (eval-string ctx s))
(print "=== CLJS Ported Part 6 ===")
(print "28: anon fn #()...")
(let [ctx (init)]
(assert (= 6 (ct-eval ctx "(#(+ % 5) 1)")) "#() %")
(assert (= 0 (ct-eval ctx "(#(do 0))")) "#() do body"))
(print " ok")
(print "29: symbol operations...")
(let [ctx (init)]
(assert (= true (ct-eval ctx "(symbol? 'foo)")) "symbol?")
(assert (= "foo" (ct-eval ctx "(name 'foo)")) "name symbol")
(assert (= "bar" (ct-eval ctx "(name :bar)")) "name keyword"))
(print " ok")
(print "30: keyword operations...")
(let [ctx (init)]
(assert (= true (ct-eval ctx "(keyword? :foo)")) "keyword?")
(assert (= :foo (ct-eval ctx "(keyword \"foo\")")) "keyword string"))
(print " ok")
(print "31: list operations...")
(let [ctx (init)]
(assert (= 3 (ct-eval ctx "(count (list 3 2 1))")) "list count")
(assert (= 1 (ct-eval ctx "(first '(1 2 3))")) "first list"))
(print " ok")
(print "\nAll CLJS Ported Part 6 tests passed!\n")