elm-explorations / elm-explorations/test

Idea: Better `Char` and `String` Fuzzers

Open
#90 6 comments 2 reactions 0 assignees View on GitHub
Design Question fuzzers
Dominant language
Elm
Stars
244
Forks
40
Avg merge
1d 23h
Merged PRs (30d)
2

Description

As mentioned in #89, I'm a fan of [`hedgehog`](https://hackage.haskell.org/package/hedgehog).

`hedgehog` comes with a useful set of [generators for characters](https://hackage.haskell.org/package/hedgehog-0.6.1/docs/Hedgehog-Gen.html#g:7) and for [strings too](https://hackage.haskell.org/package/hedgehog-0.6.1/docs/Hedgehog-Gen.html#g:8), such as (as would be written in Elm):
* `lower : Fuzzer Char`
* `alphaNum: Fuzzer Char`

These are great building blocks for larger fuzzers, as the generator for strings has the form (ignoring `Range`, discussed separately in #89):
```elm
string : Fuzzer Char -> Fuzzer String
```
Thus allowing the user to choose what class of characters to use when generating a ~list~ string.
In many cases all printable Unicode characters are invalid input.

Even if you represented valid strings _safely_ using `type MyAlphaString = MyAlphaString String`. Writing a fuzzer for `MyAlphaString` is not straightforward.

Would you accept a PR in this direction? or prefer it as a separate package?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.