重放
(s/def :ex/f fn?)
(s/def :ex/m (s/keys :opt [:ex/f]))
(s/fdef my-fn
:args (s/cat :m :ex/m))
(defn my-fn [f])
(clojure.spec.test.alpha/check `my-fn)
实际: 抛出异常 - "无法在[:m :ex/f]构造生成器,因为:ex/f"
预期:应返回一个包含失败值的结果。如果您将键规范中的 ":opt" 替换为 ":req",则会发生这种行为。
我期望这个值包含这样的失败
(ex-data (:result (:clojure.spec.test.check/ret (first (clojure.spec.test.alpha/check `my-fn))))) ;; => #:clojure.spec.alpha{:path [:m :ex/f], :form :ex/f, :failure :no-gen}