clojure.edn/read-string now delegates to clojure.core/read-string (the reader-based special form — parses, never evals) via a private helper, with the opts-map :eof arity and nil/blank-input handling. 43 -> 47 in the stdlib battery. This required an evaluator fix: special forms were matched by name only, so clojure.edn/read-string dispatched the core read-string SPECIAL FORM instead of the var. Now a head qualified to a non-core namespace resolves to its var; only unqualified or clojure.core-qualified heads are special forms. Conformance 218/218 all modes; full suite green. Remaining edn gaps (jolt-b7y): set literals read as a set FORM not a constructed set, and #uuid has no real type.
61 lines
2.4 KiB
Text
61 lines
2.4 KiB
Text
# Vendored stdlib-namespace battery (jolt-0mb).
|
|
#
|
|
# clojure.test suites for stdlib namespaces beyond clojure.core, vendored from
|
|
# clojurust's clojure-test-suite fork (test/clojure-stdlib/, with corrected
|
|
# fixtures where the upstream expectations disagreed with real Clojure). Each
|
|
# file runs in the shared per-file worker; we guard a minimum pass count so a
|
|
# regression is caught and improvements (e.g. finishing clojure.edn) can raise
|
|
# the floor.
|
|
|
|
(def files
|
|
# [relative-path min-pass must-be-clean?]
|
|
[["clojure/walk_test/walk.cljc" 34 true]
|
|
["clojure/zip_test/zip.cljc" 33 true]
|
|
["clojure/data_test/diff.cljc" 61 true]
|
|
# clojure.edn now reads via clojure.core/read-string with opts/:eof + nil/blank
|
|
# handling. The remaining 3 fails are sets (the reader yields a set FORM, not a
|
|
# constructed set) and #uuid — tracked in jolt-b7y. Guard the passing subset.
|
|
["clojure/edn_test/read_string.cljc" 47 false]])
|
|
|
|
(def root "test/clojure-stdlib")
|
|
(def per-file-timeout 6)
|
|
|
|
(defn- run-file [path]
|
|
(def proc (os/spawn ["janet" "test/integration/suite-worker.janet" path] :p {:out :pipe}))
|
|
(def out (proc :out))
|
|
(var data nil)
|
|
(def ok (try
|
|
(ev/with-deadline per-file-timeout
|
|
(set data (ev/read out 0x10000))
|
|
(os/proc-wait proc) true)
|
|
([err] false)))
|
|
(when (not ok)
|
|
(protect (os/proc-kill proc true))
|
|
(protect (ev/with-deadline 2 (os/proc-wait proc))))
|
|
(protect (:close out))
|
|
(if (and ok data) (string data) nil))
|
|
|
|
(defn- counts [s]
|
|
(var r nil)
|
|
(each line (string/split "\n" (or s ""))
|
|
(when (string/has-prefix? "@@COUNTS " line)
|
|
(let [p (string/split " " (string/trim line))]
|
|
(when (= 4 (length p)) (set r [(scan-number (p 1)) (scan-number (p 2)) (scan-number (p 3))])))))
|
|
r)
|
|
|
|
(var failures 0)
|
|
(each [rel min-pass clean?] files
|
|
(def path (string root "/" rel))
|
|
(def c (counts (run-file path)))
|
|
(if (nil? c)
|
|
(do (++ failures) (printf "FAIL %s: no result (crash/timeout)" rel))
|
|
(let [[p f e] c]
|
|
(printf " %-34s pass=%d fail=%d err=%d" rel p f e)
|
|
(when (< p min-pass)
|
|
(++ failures) (printf "FAIL %s: pass %d < baseline %d" rel p min-pass))
|
|
(when (and clean? (or (pos? f) (pos? e)))
|
|
(++ failures) (printf "FAIL %s: expected clean, got %d fail / %d err" rel f e)))))
|
|
|
|
(if (pos? failures)
|
|
(do (printf "clojure-stdlib-suite: %d failure(s)" failures) (os/exit 1))
|
|
(print "clojure-stdlib-suite: OK"))
|