clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
arohner 2020-03-31T18:10:43.024700Z

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”

2020-03-31T18:11:45.025100Z

You could generate 10 or 50 calls or something

2020-03-31T18:12:01.025600Z

Something large enough that it should never fail

arohner 2020-03-31T18:12:04.025800Z

true

2020-03-31T18:12:47.026700Z

It does seem like that would be a useful feature though

2020-03-31T18:13:08.027400Z

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

2020-03-31T18:13:45.028100Z

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

arohner 2020-03-31T18:18:42.029600Z

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

👍 1
2020-03-31T18:18:52.030Z

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