Fork me on GitHub

@miikka not at the moment, no. It's not something I've looked into so far. From a quick look at the documentation it seems like running check returns a map with information about the success/failure? It doesn't seem like there's already something in place to connect this with clojure.test. A custom assertion would do the trick.


This is untested pseudocode but it should give you an idea

(deftest checking-vars-test
  (is (spec/check? #'foo))
  (is (spec/check? #'bar)))

(defmethod clojure.test/assert-expr 'spec/check? [msg form]
  (let [v (second form)]
    `(let [result# (clojure.spec.test.alpha/check v)]
       (if (true? (:result result#))
         (clojure.test/do-report {:type :pass})
         (clojure.test/do-report {:type :fail, :expected ~form, :actual result#}))))


Feel free to make a ticket about this so this doesn't get lost. This might make sense as a separate mini library that implements a number of spec-based assertions.