Fork me on GitHub
#clojure-spec
<
2020-03-31
>
arohner18:03:43

Is there a way to get there-exists behavior to compliment for-all? Context: I have a protocol, and a bunch of implementations (30+), and a test suite that is a series of test.check properties. A broken implementation slipped through, because it returned a pathological response: i.e. (s/nilable ::foo) always returned nil. I’d like to assert during the test, “this can return nil or ::foo, but the test must return ::foo at least once”

gfredericks18:03:45

You could generate 10 or 50 calls or something

gfredericks18:03:01

Something large enough that it should never fail

gfredericks18:03:47

It does seem like that would be a useful feature though

gfredericks18:03:08

Because then you could test things of that sort without paying for 50 trials each time

gfredericks18:03:45

A similar structure is using such-that and just generating a single thing

arohner18:03:42

I think I’ve got it using such-that, thanks

👍 4
gfredericks18:03:52

There's a bunch of dumb tests in t.c itself that use the 50 things approach; it's slow