What’s the best way to test properties on a collection? I typically write
(prop/for-all [in generator] (let [ret (foo in)] (every? (fn [r] ...) ret))
, and this works, but the output on failure isn’t very nice, because test.check doesn’t know how to show the offending elementoh, one other wrinkle, the spec for each item is dynamic:
(every? (fn [m]
(s/valid? (s/spec (::p/message-type m)) m)) msgs)
so I can’t easily use (s/valid? (s/coll-of ::foo) msgs)
> test.check doesn’t know how to show the offending element this can be remedied by returning a custom Result object
you could imagine a helper for this, a variant of every?
, provided by a library or test.check itself
but the plumbing is there for getting better output