Effect CommunityEC
Effect Community2y ago
11 replies
Kroeber

FastCheck `sample` function ignoring `nonEmpty` constraint

Good afternoon everyone! Thanks for the great library, it's truly a paradigm shift for me.

I ran into a small intersection issue while sampling FastCheck arbitraries from a
string
schema. Namely, when sampling arbitraries from a
string
schema that is constrained by both pattern and nonEmpty constraints, the FastCheck sample function does not honor the nonEmpty constraint when generating arbitraries. For example:

FastCheck.sample(
  Arbitrary.make(
    Schema.NonEmpty.pipe(
      Schema.pattern(/^[A-Za-z]*$/)
    )
  ), 
5)

[ '', 'v', 'JGkTpVelCO', 'nl', 'uE' ]


...Some of the generated arbitraries will in fact be ''. Is this a known issue, or have I found a bug? Thanks in advance!
Was this page helpful?