defn docstrings, assert throws AssertionError, Seqable covers collections
Conformance gaps surfaced re-running the library suites: - defn now keeps a leading docstring as :doc metadata — it was dropped, so (:doc (meta #'f)) was always nil. Rides the def docstring slot. - assert (and :pre/:post) throw a real AssertionError instead of an ex-info, so (catch AssertionError …) / (thrown? AssertionError …) match, with Clojure's "Assert failed: <msg>\n<form>" message. - instance? clojure.lang.Seqable was conflated with ISeq, so a vector/map read as not-Seqable. Split them: Seqable covers every persistent collection, ISeq only seqs.
This commit is contained in:
parent
60e129a95c
commit
14ce46fb2a
6 changed files with 926 additions and 909 deletions
|
|
@ -208,8 +208,10 @@
|
|||
`(let [~g ~expr ~@(thread-binds g steps)] ~(if (empty? steps) g (last steps)))))
|
||||
|
||||
(defmacro assert [x & [message]]
|
||||
(let [msg (if message message (str "Assert failed: " (pr-str x)))]
|
||||
`(when-not ~x (throw (ex-info ~msg {})))))
|
||||
(let [msg (if message
|
||||
(str "Assert failed: " message "\n" (pr-str x))
|
||||
(str "Assert failed: " (pr-str x)))]
|
||||
`(when-not ~x (throw (new AssertionError ~msg)))))
|
||||
|
||||
;; (pvalues e1 e2 ...) — each expression evaluated in parallel (pcalls).
|
||||
(defmacro pvalues [& exprs]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue