test-check

steveb8n 2018-11-13T03:32:57.001200Z

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?

2018-11-13T12:52:16.001600Z

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

steveb8n 2018-11-13T21:02:59.003200Z

@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

2018-11-13T21:15:23.004100Z

@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.

2018-11-13T21:15:35.004500Z

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

2018-11-13T21:15:50.004900Z

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

steveb8n 2018-11-13T21:19:47.006900Z

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?

2018-11-13T21:23:42.007400Z

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

2018-11-13T21:25:14.007700Z

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

steveb8n 2018-11-13T23:23:47.008300Z

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

👍 1