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.
17 lines
1 KiB
Text
17 lines
1 KiB
Text
# 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))"])
|