typelevel / weaver-test

A test framework that runs everything in parallel.
https://typelevel.org/weaver-test/
Other
46 stars 8 forks source link

Fail property test when discard count exceeds `maximumDiscarded` #112

Closed zainab-ali closed 2 weeks ago

zainab-ali commented 2 weeks ago

Property tests with a maximumDiscarded value of zero fail without running any tests. This is a bug introduced by the stream refactors in https://github.com/typelevel/weaver-test/pull/39.

This is because the status stream now outputs an initial empty Status.start value which satisfies the discard <= maximumDiscarded stop condition.

Prior to the refactor, the stream wouldn't output the Status.start value, so a single test would be run before the condition was checked. This behaviour was also odd: even if no values were actually discarded, the property test could fail with a discard error.

This PR alters the discard behaviour. The discard count must exceed the maximumDiscarded value, not be equal to it. This means that if a maximumDiscarded value of 0 is set, then the test will fail if 1 value is discarded.