[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

Activity

Show:
Alex Miller
September 22, 2016, 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.

Griffin Smith
January 30, 2017, 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.

Griffin Smith
January 30, 2017, 12:40 AM
Griffin Smith
January 30, 2017, 12:51 AM

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

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

Duplicate of ?

Assignee

Unassigned

Reporter

import

Labels

Approval

Triaged

Patch

None

Affects versions

Priority

Minor