test(spec): lazy sequences, transducers, metadata
Add spec suites covering lazy-seq/lazy-cat laziness, infinite + self-referential seqs (ones/nats/fib), realized?; transducers (map/filter/take/cat/keep/mapcat as xforms, comp, into/transduce/sequence/eduction/completing); and metadata (with-meta/meta/vary-meta/^ reader). All passed against jolt as written — no implementation changes needed. jpm test green.
This commit is contained in:
parent
a24e9bfba0
commit
e3d2aa8d14
3 changed files with 70 additions and 0 deletions
11
test/spec/metadata-spec.janet
Normal file
11
test/spec/metadata-spec.janet
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Specification: metadata.
|
||||
(use ../support/harness)
|
||||
|
||||
(defspec "metadata / with-meta & meta"
|
||||
["meta of bare value" "nil" "(meta [1 2 3])"]
|
||||
["with-meta then meta" "{:a 1}" "(meta (with-meta [1 2 3] {:a 1}))"]
|
||||
["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))"]
|
||||
["meta reader ^" "{:tag :int}" "(meta ^{:tag :int} [1 2])"]
|
||||
["with-meta on fn ok" "true" "(fn? (with-meta inc {:a 1}))"])
|
||||
Loading…
Add table
Add a link
Reference in a new issue