Skip to content

v2.4.0

Choose a tag to compare

@rasuvaeff rasuvaeff released this 01 Aug 22:17
· 45 commits to master since this release

In-body dependent draw (T2.5). Additive, no BC breaks; existing seed sequences
are unchanged (a property that never calls Gen::draw() generates exactly the
same values as before).

  • Fix: aggregate property results now carry the per-run TestResult
    attributes (merged run-by-run, last write per key wins) on all paths —
    passed, falsified, coverage violation and failing explicit example.
    Previously the interceptor returned a bare TestResult, dropping
    attributes attached by downstream interceptors — notably Testo codecov's
    CoverageResult, so property tests were missing from per-test coverage
    (<covered by>), and mutation-testing tools like Infection never selected
    them when running mutants: mutants on lines covered only by property tests
    escaped silently.

  • Add Gen::draw($arbitrary) — generate a value inside the property body when
    several dependent values make nested flatMap awkward. The domain may depend
    on parameters, previous draws, or intermediate results.

  • Drawn values shrink together with the parameters via a replay tape: every
    draw is recorded as a Shrinkable, shrunk through its own tree, and the body
    is re-run with the tape replayed by position. Draws past the tape's end
    (control flow changed under a smaller prefix) are generated anew; draws the
    smaller run no longer reaches are dropped.

  • Counterexamples report draws as draw#1, draw#2, ... next to the named
    parameters; PROPERTY_VERBOSE additionally logs each run's draws.

  • With draws present, accepted shrink steps are capped at 1000 (an explicit
    maxShrinks still wins) — a regrown tape carries fresh trees, so the
    finite-tree termination argument alone no longer applies.

  • Gen::draw() outside a property run throws a RuntimeException. Explicit
    examples may draw too (their draws come from a dedicated deterministic
    stream).