This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-21
Channels
- # adventofcode (60)
- # aleph (2)
- # announcements (3)
- # architecture (2)
- # babashka (12)
- # beginners (90)
- # calva (14)
- # cider (32)
- # clj-kondo (1)
- # clj-together (7)
- # cljsrn (4)
- # clojars (10)
- # clojure (161)
- # clojure-dev (110)
- # clojure-europe (58)
- # clojure-nl (3)
- # clojure-spec (35)
- # clojure-taiwan (1)
- # clojure-uk (24)
- # clojuredesign-podcast (3)
- # clojurescript (27)
- # conjure (47)
- # cursive (17)
- # data-science (1)
- # datomic (1)
- # depstar (6)
- # fulcro (20)
- # java (4)
- # jobs-rus (1)
- # luminus (4)
- # malli (10)
- # off-topic (8)
- # re-frame (4)
- # reagent (1)
- # reitit (9)
- # reveal (1)
- # rewrite-clj (8)
- # ring (3)
- # sci (44)
- # shadow-cljs (5)
- # spacemacs (6)
- # specter (8)
- # tools-deps (6)
- # vim (1)
- # xtdb (11)
(do
(defn f [x] x)
(s/fdef f :ret int?)
(stest/instrument)
(f "hello"))
i would expect this to throw, but i don't see that happening. what am i missing?are you doing this in the repl? I've had surprising behavior wrapping defn and similar in do/let. Try executing line-by-line?
instrument
checks that your function is being called correctly by other code. check
is what you use to generatively test the behavior of the function itself.
@U04V70XH6, thank you!
i misunderstood instrument
I think almost everyone does when they first start using Spec.
There is an unofficial spec tool which will check return values as well, called orchestra
I think that library is a bit misguided since it deliberately blurs the lines that Clojure Spec draws by design. Caveat programmer.
No comment 🙂
I saw in the #announcements channel that guardrails now has an async instrumentation thing, so it doesn't slow down your functions but you will eventually know something is wrong - at least that's what I got from it
yeah, it's optional. I think the approach with guardrails is by default just to log the failures
I *reall*y wonder what spec2 will do in that regard, since apparently it's one area where there's some heavy hammocking going on. [edit] By that I don't mean Rich is heavy!
but yes, guardrails is the most interesting of the bunch so far imho. One thing is missing is editor support (indentation annotations), it's a bit ugly out of the box
you mean like flycheck integration? that's pretty easy if you have file:line:col: ERROR message kind of output