Created
May 31, 2016 15:55
-
-
Save alexanderkiel/931387c7a86c1879b2267ad064067af7 to your computer and use it in GitHub Desktop.
Integration of check-var in clojure.test/is
This file contains hidden or 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
(defmethod assert-expr 'conform-var? [msg form] | |
;; Test if the var v conforms to it's spec. | |
(let [args (rest form)] | |
`(let [result# (clojure.spec.test/check-var ~@args)] | |
(if (true? (:result result#)) | |
(do-report {:type :pass :message ~msg | |
:expected '~form :actual result#}) | |
(do-report {:type :fail :message ~msg | |
:expected '~form :actual result#})) | |
result#))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
conform-var?
this way: