Skip to content

Instantly share code, notes, and snippets.

@bhb
Created Nov 9, 2017
Embed
What would you like to do?
Testing instrumentation with expound
user=> (require '[expound.alpha :as expound])
nil
user=> (require '[clojure.spec.test.alpha :as st])
nil
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/fdef foo :args (s/cat :int int?))
user/foo
user=> (defn foo [x] x)
#'user/foo
user=> (st/instrument)
[expound.printer/indent expound.paths/prefix-path? expound.alpha/specs expound.paths/kvps-path? user/foo expound.alpha/value-in-context expound.printer/pprint-str expound.paths/kps-path? expound.problems/summary-form expound.printer/no-trailing-whitespace]
user=> (set! s/*explain-out* expound/printer)
#function[expound.alpha/printer]
user=> (foo "")
ExceptionInfo Call to #'user/foo did not conform to spec:
form-init4994507209937619287.clj:1
-- Spec failed --------------------
Function arguments
("")
^^
should satisfy
int?
-------------------------
Detected 1 error
clojure.core/ex-info (core.clj:4744)
user=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment