This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-12
Channels
- # beginners (34)
- # boot (14)
- # cider (2)
- # cljs-dev (21)
- # cljsrn (1)
- # clojure (31)
- # clojure-android (10)
- # clojure-spec (12)
- # clojure-uk (3)
- # clojurescript (64)
- # cursive (31)
- # data-science (9)
- # datomic (27)
- # fulcro (11)
- # graphql (14)
- # jobs (1)
- # leiningen (1)
- # lumo (27)
- # off-topic (65)
- # om (2)
- # onyx (77)
- # pedestal (1)
- # re-frame (4)
- # shadow-cljs (6)
- # vim (1)
- # yada (3)
Is there a 'normal' way to use function specs in your automated test suite? I feel like I haven't found a good solution to this - likely because I haven't written a regular test.check
suite either.
wrapping a call in clojure.test/is
is pretty easy
I was wondering if there was already (`test.check`?) library function that would do something like that (some 'idiomatic' way).
Is using function specs in the test suite a normal thing that people do, or are folks just using spec
for development time help?
I would certainly put them in the test suite if I were using spec
@jamesvickers19515 We use spec in all sorts of ways. We use it heavily in production code for validating and conforming input parameters, specifying data structures (and then leveraging the form of the spec to "reflect" and get the set of keys that are "permitted", e.g., when storing hash maps in a SQL table), in tests via s/instrument
, in tests via s/exercise
to generate conforming test data.
In some cases we use test.check
as part of a regular test, but generally we have those as separate tests we run apart from our unit tests -- generative testing often takes quite a while so it probably shouldn't be part of your unit test suite.
I'm seeing an inconsistency between Clojure and ClojureScript for multi-arity fdefs. https://gist.github.com/jeaye/eaa8da70171a538e23b3c5dbfd9797fd
That spec catches the errors just fine, on Clojure, for all the arities. On ClojureScript, bad calls don't get caught by instrumentation at all.
Updated the gist; looks like a simple defn
, with the same spec, throws for both cases (as it should). So this is specific to something happening in ClojureScript's multi-arity defn
.