Fork me on GitHub
#clojure-spec
<
2017-09-13
>
thedavidmeister13:09:08

how would i put together a spec for a map with string keys and values that are vectors of strings?

Alex Miller (Clojure team)13:09:36

(s/map-of string? (s/coll-of string? :kind vector?))

thedavidmeister13:09:56

is (spec/map-of string? (spec/+ string?)) ok?

Alex Miller (Clojure team)13:09:19

I would recommend coll-of in this case

Alex Miller (Clojure team)13:09:46

it gives you more control over size constraints, generation, etc and is a better match for what you described

Alex Miller (Clojure team)13:09:25

s/+ is for describing sequential collections with internal structure along with the other regex ops. while what you have will work, you’re not really using any of those features

bfabry18:09:43

no doubt this has been asked 1k times, but it's probably evolving. what are people currently doing to turn on instrumentation for their test run? top of the file in test_helpers.clj that's required by every test, fixture that's used by every test?

Alex Miller (Clojure team)18:09:43

once fixture seems like a good place for that

bfabry18:09:37

makes sense

joost-diepenmaat19:09:33

@bfabry we’re using :once fixtures,

joost-diepenmaat19:09:50

works ok, unless you forget to use the fixture 😕

jumar20:09:23

@bfabry we're using lein profiles and injections - something like this:

:injections   [(require 'clojure.spec.test)
                                             (clojure.spec.test/instrument)
                                             (.println System/err "Instrumented specs")]