Skip to content

Instantly share code, notes, and snippets.

@bhb
Created April 27, 2018 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhb/d8de0dd2bd046124c57131cb8e49da36 to your computer and use it in GitHub Desktop.
Save bhb/d8de0dd2bd046124c57131cb8e49da36 to your computer and use it in GitHub Desktop.
Expound printing mimimized failing input
(require '[expound.alpha :as expound] '[clojure.spec.test.alpha :as st] '[clojure.spec.alpha :as s])
(s/fdef foo :args (s/cat :x pos-int?) :ret (s/int-in 0 5))
(defn foo [x] x)
(set! s/*explain-out* expound/printer)
(expound/explain-results (st/check `foo))
;;== Checked user/foo =========================
;;
;;-- Function spec failed -----------
;;
;; (user/foo 5)
;;
;;returned an invalid value.
;;
;; 5
;;
;;should satisfy
;;
;; (fn [%] (clojure.spec.alpha/int-in-range? 0 5 %))
;;
;;-------------------------
;;Detected 1 error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment