[TCHECK] clojure.test.check.generators/keyword generates invalid keyword `:/`

Description

`clojure.test.check.generators/keyword` returns the keyword `:/`, which is invalid, this is presumably to be consistent with the `symbol` generator.

However, this makes the generator less useful than it could be for testing, since the handling of that keyword is undefined and inconsistent, e.g. in

I have attached a patch that changes the behaviour of that generator. (CA signed)

Environment

None

Activity

Show:
gfredericks
June 7, 2019, 3:08 PM

Ruling from Alex Miller on slack:

:/ is "open for the language to start interpreting" and not an invalid keyword so should be ok to generate. and cljs should fix it's weirdness.

So I'll close this ticket, and somebody can create a CLJS ticket if one doesn't exist already.

Arne Brasseur
July 10, 2020, 8:40 AM

I’d like to propose reopening this ticket (see https://ask.clojure.org/index.php/9427/clarify-the-position-of-as-a-keyword). If the behavior and semantics of :/ are undefined (which they are, see the link), but test.check still generates it then test.check implies that people should make sure their code can handle it.

This would be less of a problem if the implementations of Clojure and ClojureScript handled it the same way, but they don’t, and ClojureScript has no incentive to address that since it’s not valid syntax. This means that cross-platform cljc code needs extra checks or reader conditionals, to deal with input it should not have to care about.

This is of course easy to address by the user with a gen/such-that, but if people are unaware of the specific status of :/ that may seem like the wrong thing to do.

Camilo Polymeris
July 10, 2020, 12:40 PM

For context, the weirdness that led me to originally open this ticket was caused by this CLJS inconsistency:

This was fixed in https://clojure.atlassian.net/projects/CLJS/issues/CLJS-3202

Alex Miller
July 10, 2020, 1:31 PM

I've made the change and will cut a release when maven central starts working again.

Alex Miller
July 10, 2020, 5:42 PM

Released in test.check 1.1.0

Assignee

Alex Miller

Reporter

Camilo Polymeris

Labels

None

Approval

None

Patch

None

Priority

Major
Configure