It should be clearly communicated to the user when generators are deprecated. This patch supplies helpers for easily deprecating generators.
def-throwing-generator receives the metadata that its generator will throw if its called. As an example, suppose deprecated-generator was deprecated in 0.5.9.
(def-throwing-generator deprecated-generator
"deprecated-generator has been deprecated. Use current-generator instead."
{:deprecated "0.5.9"})
Then if the user looked up its documentation, they would see from cider:
clojure.test.check.generators/deprecated-generator
Deprecated in 0.5.9
deprecated-generator has been deprecated. Use current-generator instead.
or if they used the generator and ran cider-test, they would see:
Test Summary
foobar.core-test
Ran 1 tests, in 1 test functions
1 errors
Results
Error in a-test
FIXME, I fail.
expected: (= "a" (sample deprecated-generator 5))
actual: clojure.lang.ExceptionInfo: deprecated-generator has been deprecated. Use current-generator instead. {:deprecated "0.5.9"}