UnkindPartition / tasty

Modern and extensible testing framework for Haskell
640 stars 110 forks source link

Initial options #427

Open phadej opened 3 months ago

phadej commented 3 months ago

It turns out tasty very much had all building blocks to allow specifying initial option set. This may solve #414

This PR is a draft, I'd welcome if anyone takes over as I did the least possible as a proof-of-concept (no haddocks for example).

The options-example "test-suite" is a demo.

cabal run options-example -- --help prints

  --quickcheck-tests NUMBER
                           Number of test cases for QuickCheck to generate.
                           Underscores accepted: e.g. 10_000_000 (default: 1000)

(I made default value visible).

and if you run test the output is

options-example
  assoc: OK
    +++ OK, passed 1000 tests.

so the value is actually used. But it can still be overridden with --quickcheck-tests: cabal run options-example -- --quickcheck-tests 1234

options-example
  assoc: OK
    +++ OK, passed 1234 tests.

This patch is done on 10% Well-Typed time.

Bodigrim commented 2 months ago

This looks a reasonable way to address the problem in #414, but I'm extremely cautious to extend API beyond absolutely necessary. I'd like to hear from other maintainers.