This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-05
Channels
- # adventofcode (246)
- # aleph (5)
- # aws (7)
- # beginners (161)
- # boot (3)
- # calva (42)
- # cider (40)
- # clara (10)
- # cljdoc (7)
- # cljs-dev (40)
- # cljsrn (6)
- # clojure (170)
- # clojure-dev (8)
- # clojure-greece (2)
- # clojure-italy (15)
- # clojure-kc (2)
- # clojure-new-zealand (13)
- # clojure-nl (13)
- # clojure-russia (3)
- # clojure-spec (5)
- # clojure-uk (160)
- # clojurescript (72)
- # clojurex (1)
- # cursive (7)
- # data-science (9)
- # datascript (1)
- # datomic (120)
- # devcards (4)
- # emacs (18)
- # figwheel-main (10)
- # fulcro (34)
- # kaocha (3)
- # luminus (1)
- # lumo (6)
- # music (1)
- # nrepl (23)
- # off-topic (2)
- # pedestal (4)
- # re-frame (42)
- # reagent (36)
- # reitit (10)
- # ring-swagger (21)
- # shadow-cljs (124)
- # spacemacs (6)
- # tools-deps (14)
- # unrepl (3)
- # vim (2)
@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#}))))