Skip to content

Instantly share code, notes, and snippets.

@bhb
Created March 2, 2018 17:28
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/44d68a7ab878187b68d4fd48579d591b to your computer and use it in GitHub Desktop.
Save bhb/44d68a7ab878187b68d4fd48579d591b to your computer and use it in GitHub Desktop.
`is` vs `explain` with expound
> brew install clojure
> clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "cbc5b3c73d4788a25570f125e5f2de23a3d2bf5f"}}}' -m friendly
user=> (require '[expound.alpha :as expound])
user=> (require '[clojure.test :refer [is]])
nil
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (is (let [xs ["a" "b" :c "d"]]
#_=> (is (and (vector? xs)
#_=> (every? string? xs)))))
FAIL in () (NO_SOURCE_FILE:2)
expected: (and (vector? xs) (every? string? xs))
actual: false
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/explain (s/coll-of string?) ["a" "b" :c "d"])
nil
-- Spec failed --------------------
["a" "b" :c "d"]
^^
should satisfy
string?
-------------------------
Detected 1 error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment