Welcome! Please see the About page for a little more info on how this works.

0 votes
in Spec by
As of Spec 0.2.176, when test.check cannot generate a suitable value, it fails with a rather useless error message that does not point to the thing it was trying to generate:

ExecutionException: clojure.lang.ExceptionInfo: Couldn't satisfy such-that predicate after 100 tries. {:pred #object[clojure.spec.alpha$gensub$fn__1876 0x669d7a6a "clojure.spec.alpha$gensub$fn__1876@669d7a6a"], :gen #clojure.test.check.generators.Generator{:gen #object[clojure.test.check.generators$such_that$fn__1111 0x5fc56c81 "clojure.test.check.generators$such_that$fn__1111@5fc56c81"]}, :max-tries 100}

It would be I believe much better if the generator created by _(s/gen ::myspec)_ somehow included the ::myspec name so that it would print out something like

    :gen #object[clojure.test.check.generators$such_that$fn__1111 0x5fc56c81 ":my.ns/myspec"]}}

(Notice the `.toString` of the generated generator has been modified to print the spec name: ":my.ns/myspec"; though perhaps "gen for :my.ns/myspec" would be clearer.)

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CLJ-2513 (reported by holyjak)