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
This commit is contained in:
Yogthos 2026-06-03 23:44:49 -04:00
parent 9ac8f26a70
commit 0e08f65016
42 changed files with 770 additions and 837 deletions

View file

@ -36,7 +36,8 @@
(let [ctx (init)]
(assert (= "hello" (ct-eval ctx "(str \"hello\")")) "str")
(assert (= "42" (ct-eval ctx "(str 42)")) "str number")
(assert (= "a" (ct-eval ctx "(name :a)")) "name"))
(assert (= "a" (ct-eval ctx "(name :a)")) "name")
(assert (= ":hello" (ct-eval ctx "(pr-str :hello)")) "pr-str keyword"))
(print " ok")
(print "17: apply...")
(let [ctx (init)]
@ -47,7 +48,8 @@
(let [ctx (init)]
(assert (= true (ct-eval ctx "(= {:a 1 :b 2} {:b 2 :a 1})")) "map order-independent")
(assert (= false (ct-eval ctx "(= {:a 1} {:a 2})")) "map different values")
(assert (= 3 (ct-eval ctx "(count (quote (1 2 3)))")) "quote list count"))
(assert (= 1 (ct-eval ctx "(:a (with-meta {:a 1} {:c 3}))")) "with-meta preserves value")
(assert (= 3 (ct-eval ctx "(:c (with-meta {:a 1} {:c 3}))")) "with-meta preserves meta via get"))
(print " ok")
(print "19: higher-order...")
(let [ctx (init)]
@ -58,6 +60,8 @@
(print "20: seq edge cases...")
(let [ctx (init)]
(assert (= nil (ct-eval ctx "(seq [])")) "seq empty")
(assert (= nil (ct-eval ctx "(seq nil)")) "seq nil")
(assert (= nil (ct-eval ctx "(first nil)")) "first nil")
(assert (= 1 (ct-eval ctx "(first [1 2 3])")) "first vector"))
(print " ok")
(print "21: atoms extended...")
@ -67,6 +71,7 @@
(ct-eval ctx "(reset! a 42)")
(assert (= 42 (ct-eval ctx "(deref a)")) "reset!")
(ct-eval ctx "(swap! a inc)")
(assert (= 43 (ct-eval ctx "(deref a)")) "swap! inc"))
(assert (= 43 (ct-eval ctx "(deref a)")) "swap! inc")
(assert (= 43 (ct-eval ctx "@a")) "@ deref macro"))
(print " ok")
(print "\nAll CLJS Ported Part 2 tests passed!")