Fork me on GitHub
#test-check
<
2018-11-13
>
steveb8n03:11:57

I find it tricky to quickly find the cause when I get “clojure.lang.ExceptionInfo: Couldn’t satisfy such-that predicate after 100 tries. {}” back from generators. I can find it using binary search but is there a better technique for debugging these generator errors?

gfredericks12:11:16

@steveb8n is this a (gen/such-that ...) that you wrote yourself, or that spec wrote for you?

steveb8n21:11:59

@gfredericks using gens from specs (I hardly ever use such-that gens). To me this is the hardest part of using generators so any tricks (or context data in the error) would help

gfredericks21:11:23

@steveb8n there's a ticket somewhere describing that problem I think -- I added extra optional args to gen/such-that so that spec could add explanatory information to exceptions, but I don't believe that's been taken advantage of by spec.

gfredericks21:11:35

and in any case it's only released in the alpha versions 😕

gfredericks21:11:50

someday I should just give up and release whatever's on master so at least there's not that problem anymore

steveb8n21:11:47

hah, I thought this might be the case. I also thought that providing useful debug data would be tricky since specs can vary wildly. in lieu of that, how do you hunt these down? binary search (with knowledge of the specs to guide you) or some other cleverness?

gfredericks21:11:42

I haven't personally used spec a lot I think knowing that s/and is the most likely culprit is usually helpful

gfredericks21:11:14

and thinking about generation whenever you write s/and in the first place

steveb8n23:11:47

true that. I am using s/and extensively. I’ll ponder that a little. Thanks.

👍 4