Skip to content

Instantly share code, notes, and snippets.

@bhb
Created August 26, 2017 01:06
Show Gist options
  • Save bhb/329710eeeb7e23c5a0949425188731c0 to your computer and use it in GitHub Desktop.
Save bhb/329710eeeb7e23c5a0949425188731c0 to your computer and use it in GitHub Desktop.
Setting up instrumentation on clojure.core with Expound
;; Set up instrumentation somewhere in your project
;; (only need to do this once)
(require '[clojure.core.specs.alpha])
(require '[clojure.spec.alpha :as s])
(require '[clojure.spec.test.alpha :as stest])
(require '[expound.alpha :as expound])
(set! s/*explain-out* expound/printer)
(stest/instrument)
;;; later on ...
(ns "docstring " foo.bar)
;; CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec:
;; -- Spec failed --------------------
;; ("docstring " ...)
;; ^^^^^^^^^^^^
;; should satisfy
;; simple-symbol?
;; -- Relevant specs -------
;; :clojure.core.specs.alpha/ns-form:
;; (clojure.spec.alpha/cat
;; :name
;; clojure.core/simple-symbol?
;; :docstring
;; (clojure.spec.alpha/? clojure.core/string?)
;; :attr-map
;; (clojure.spec.alpha/? clojure.core/map?)
;; :clauses
;; :clojure.core.specs.alpha/ns-clauses)
;; -------------------------
;; Detected 1 error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment