core: start Phase 4 — move vary-meta and namespace-munge to the overlay
First Phase 4 batch: the host-coupled fns whose logic is pure composition of existing core primitives, so no new jolt.host surface is needed. vary-meta is just (with-meta obj (apply f (meta obj) args)); namespace-munge is a char map over str. Both land in the 20-coll tier; the Janet core-* defns and bindings are gone. Added namespace-munge spec cases and a vary-meta extra-args case. The heavily host-coupled fns (atom/var/transient internals, arrays, proxy, futures) stay in Janet pending a thin host-primitive expansion.
This commit is contained in:
parent
8bc5bd6f61
commit
e6ff4b8a77
4 changed files with 20 additions and 6 deletions
|
|
@ -7,6 +7,7 @@
|
|||
["with-meta preserves value" "true" "(= [1 2 3] (with-meta [1 2 3] {:a 1}))"]
|
||||
["with-meta on map" "{:doc \"x\"}" "(meta (with-meta {:k 1} {:doc \"x\"}))"]
|
||||
["vary-meta" "{:a 2}" "(meta (vary-meta (with-meta [1] {:a 1}) update :a inc))"]
|
||||
["vary-meta extra args" "{:a 1 :b 2}" "(meta (vary-meta (with-meta [1] {:a 1}) assoc :b 2))"]
|
||||
["meta reader ^" "{:tag :int}" "(meta ^{:tag :int} [1 2])"]
|
||||
["with-meta on fn ok" "true" "(fn? (with-meta inc {:a 1}))"]
|
||||
["with-meta nil clears" "nil" "(meta (with-meta [1 2 3] nil))"])
|
||||
|
|
|
|||
|
|
@ -48,3 +48,8 @@
|
|||
["subs end past len" :throws "(subs \"abcde\" 1 6)"]
|
||||
["subs nil start" :throws "(subs \"abcde\" nil 2)"]
|
||||
["subs on nil" :throws "(subs nil 1 2)"])
|
||||
|
||||
(defspec "string / namespace-munge"
|
||||
["hyphens to underscores" "\"a_b_c\"" "(namespace-munge \"a-b-c\")"]
|
||||
["from a symbol" "\"foo_bar\"" "(namespace-munge (quote foo-bar))"]
|
||||
["no hyphens unchanged" "\"ok\"" "(namespace-munge \"ok\")"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue