There is already several ways to specify the number of tests.
E.g.:
- How to get Haskell QuickCheck 2.4 to increase # tests?
- Haskell Test.Framework specify number of tests to run from command line
- How to run an individual test with Stack and Haskell Test.Framework?
- Test.Framework 'plusTestOptions' and 'testProperty'
However, how to pass the parameters to defaultMainWithOpts
?
Furthermore, is it working at all or can I apply maxSuccess
somewhere else?
The most examples that I know off have mempty
as second parameter for defaultMainWithOpts
.
import qualified Test.Framework as TF
import qualified Test.Framework.Providers.HUnit as FHU
import qualified Test.Framework.Providers.QuickCheck2 as QC2 -- supports Test.QuickCheck with 'testProperty'
import qualified Test.HUnit as HU
import qualified Test.QuickCheck as QC
...
main :: IO ()
main =
TF.defaultMainWithOpts
[
FHU.testCase "..." (... HU.@?= ...),
QC2.testProperty
"..."
(\xyz ->
(
(...)
QC.==>
(...) ) ),
QC2.testProperty
"..."
(\xyz ->
(
(...)
QC.==>
(...) ) )
]
mempty
...
The function defaultMainWithOpts
has type [Test] -> RunnerOptions -> IO ()
.
...and RunnerOptions
is defined as
type RunnerOptions = RunnerOptions' Maybe
Hä? What is RunnerOptions'
and why is there Maybe
?
RunnerOptions'
is defined as:
data RunnerOptions' f = RunnerOptions {
ropt_threads :: f Int
ropt_test_options :: f TestOptions
ropt_test_patterns :: f [TestPattern]
ropt_xml_output :: f (Maybe FilePath)
ropt_xml_nested :: f Bool
ropt_color_mode :: f ColorMode
ropt_hide_successes :: f Bool
ropt_list_only :: f Bool }
What is this supposed to mean?
Long story short: How to pass the number of tests to defaultMainWithOpts?