test(spec): macros, reader, host-interop, namespaces — fix def-doc, resolve, %&

Final spec areas. Bugs caught and fixed:
- (def name docstring value) used the docstring as the value; now the 3-arg
  docstring form binds the value and records :doc meta
- resolve was a nil stub; now a special form resolving a symbol to its var
  (nil if unresolved). Added find-ns (non-creating lookup) and ns-name.
- in-ns didn't evaluate its arg, so (in-ns 'foo) failed; now evaluates it per
  Clojure (the integration test's unquoted form updated to the quoted idiom)
- #(... %& ...) built %& as a positional param instead of a & rest param;
  now emits (fn* [... & gen] ...) so %& captures the rest

Full public-API spec layer now in place. conformance 218/218, jpm test green.
This commit is contained in:
Yogthos 2026-06-05 00:35:48 -04:00
parent e3d2aa8d14
commit ad5539b0de
8 changed files with 140 additions and 12 deletions

View file

@ -0,0 +1,17 @@
# Specification: host (Janet) interop — the `.` forms and jolt.interop.
(use ../support/harness)
(defspec "interop / dot forms"
["method call" "\"v=41\""
"(. {:value 41 :describe (fn [self] (str \"v=\" (:value self)))} describe)"]
["method with args" "\"Hello Alice\""
"(. {:greet (fn [self n] (str \"Hello \" n))} greet \"Alice\")"]
["field access .-" "41" "(.-value {:value 41})"]
["dot field keyword" "41" "(. {:value 41} :value)"])
(defspec "interop / jolt.interop"
["janet-type quoted list" ":array" "(do (require (quote [jolt.interop :as j])) (j/janet-type (quote (1 2))))"]
["janet-type list" ":array" "(do (require (quote [jolt.interop :as j])) (j/janet-type (list 1 2)))"]
["janet-type string" ":string" "(do (require (quote [jolt.interop :as j])) (j/janet-type \"x\"))"]
["janet-type number" ":number" "(do (require (quote [jolt.interop :as j])) (j/janet-type 1))"]
["janet-type keyword" ":keyword" "(do (require (quote [jolt.interop :as j])) (j/janet-type :a))"])