test-check

kenny 2020-02-24T16:19:58.000900Z

Is there a way to know if the output from quick-check was the result of a generator throwing an exception versus the function throwing an exception?

2020-02-24T16:22:30.001300Z

I don't think generator exceptions get caught

kenny 2020-02-24T16:23:10.001900Z

Ah. I'm calling via spec's check which does not throw in that case which explains the weird looking output.

2020-02-24T16:23:47.002800Z

Does it catch exceptions?

kenny 2020-02-24T16:24:06.003200Z

It appears so. When a gen throws, it attaches the generator exception on the :result key and nothing else.

2020-02-24T16:24:38.003700Z

Is it calling the generator manually?

2020-02-24T16:24:50.004Z

Or it just catches everything?

kenny 2020-02-24T16:26:39.004900Z

Hmm actually that's not even a generator throwing. It's a gen throwing while being constructed.

2020-02-24T16:26:52.005100Z

Yeah

kenny 2020-02-24T16:27:19.005500Z

Bad test case. Will see what happens when a gen actually throws.

2020-02-24T16:27:31.005900Z

I don't like that return value

kenny 2020-02-24T16:27:37.006100Z

Agreed

kenny 2020-02-24T16:27:58.006400Z

I'm checking for it like this haha

(and (instance? Throwable (:result ret))
     (nil? (:shrunk ret)))

2020-02-24T16:28:15.006800Z

Uckh

✔️ 1
kenny 2020-02-24T16:29:19.007200Z

Same thing when the gen throws

2020-02-24T16:29:56.007600Z

Different part of the code returns the same thing?

kenny 2020-02-24T16:30:03.007800Z

Yep

kenny 2020-02-24T16:31:12.008500Z

I don't think there's any way for me to differentiate an exception from a generator throwing while construction and a generator throwing while generating.

2020-02-24T16:32:40.008900Z

Except the stack trace 😉

kenny 2020-02-24T16:33:09.009500Z

Yeah... Not sure where it's catching the gen throwing case.

kenny 2020-02-24T16:33:52.009800Z

It's not in that ns. Must be doing it elsewhere.