[spec] When a generator fails to gen, state which spec/pred failed

Description

Given a generator using such-that that fails to find a value, the error does not give enough information to determine which spec or predicate was at fault:

Another special case of this is when providing a custom generator that produces a valid that doesn't satisfy the spec (Clojure adds this filter internally):

Proposal: Indicate in the error which spec failed to generate and possibly the path in the overall spec if feasible.

(Note: original description moved to comment)

Environment

None

Attachments

1

Activity

Show:

Jakub Holý October 8, 2019 at 2:42 PM

Duplicate of ?

Griffin Smith January 30, 2017 at 12:51 AM

Attached the patch for future reference (`better-such-that-info.patch`).

Griffin Smith January 30, 2017 at 12:40 AM

Griffin Smith January 30, 2017 at 12:37 AM

It looks like test.check is being updated to support error customization: https://github.com/clojure/test.check/commit/5aea0e275257680b672309b1e940be6dae92c17d . I've got a patch which updates clojure.spec to use it, though obviously it doesn't work since the linked commit hasn't made it into a released version of test.check yet.

Alex Miller September 22, 2016 at 10:07 PM

I'm not sure that this is possible right now based on what we give to and get back from test.check.

Details

Assignee

Reporter

Labels

Approval

Triaged

Priority

Affects versions

Created September 21, 2016 at 3:21 PM
Updated October 8, 2019 at 2:42 PM