-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ascii/latin1/unicode character generators #96
Conversation
src/Hedgehog/Gen.fs
Outdated
@@ -354,7 +368,7 @@ module Gen = | |||
|
|||
/// Generates a random string. | |||
let string : Gen<string> = | |||
choice [alphaNum; charBounded] |> string' | |||
choice [alphaNum; unicodeAll] |> string' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be just unicode
given the surrogates won't be a legal string unless they're combined correctly? (sorry I don't know that much about unicode surrogates, but I get the impression this wouldn't be a valid string as such)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... True, unicode
is a better default, I'll change it.
And, I think, we need something similar in the Haskell version? Right now it uses min/max bounds of char, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a haskell version, the haskell Gen.string
takes a Gen<char>
as an argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done now in 4979fb5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I wonder if we should just rename string'
-> string
and delete this, let people make their own choices for characters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was exactly what I was thinking right now... We're going to have Gen.fs
in line with the Haskell one anyway, so good idea. I'll undo 4979fb5 also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I just pushed f39c328.
… the specified character generator. This brings the Gen module closer to the Haskell version. See also: #96 (comment)
👍 sorry for the delay |
In line with hedgehogqa/haskell-hedgehog#73.