Created
November 9, 2017 15:22
-
-
Save bhb/f538f2b1a47eb7a1514da0fe62d46265 to your computer and use it in GitHub Desktop.
Testing instrumentation with expound
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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