diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-12-12 19:55:34 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-12-12 19:55:34 +0100 |
commit | 5b1b94aab78f210fd32f92f7d96857b448da73ca (patch) | |
tree | 74d8e1c5399c95122e43b640ccf51dee4a9098e5 /src | |
parent | 224366e2c668784952ab613c7640d7017ce60990 (diff) |
Repeat option on command line
Changelog: Add --repeat option to run the tests multiple times
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs index 20b3da2..fee776f 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -25,6 +25,7 @@ import Version data CmdlineOptions = CmdlineOptions { optTest :: TestOptions + , optRepeat :: Int , optShowVersion :: Bool , optVerbose :: Bool } @@ -32,6 +33,7 @@ data CmdlineOptions = CmdlineOptions defaultCmdlineOptions :: CmdlineOptions defaultCmdlineOptions = CmdlineOptions { optTest = defaultTestOptions + , optRepeat = 1 , optShowVersion = False , optVerbose = False } @@ -61,6 +63,9 @@ options = , Option ['k'] ["keep"] (NoArg $ to $ \opts -> opts { optKeep = True }) "keep test directory even if all tests succeed" + , Option ['r'] ["repeat"] + (ReqArg (\str opts -> opts { optRepeat = read str }) "COUNT") + "number of times to repeat the test(s)" , Option ['V'] ["version"] (NoArg $ \opts -> opts { optShowVersion = True }) "show version and exit" @@ -118,5 +123,6 @@ main = do Nothing -> fileTests Just name -> filter ((==name) . testName) fileTests - ok <- allM (runTest out $ optTest opts) $ concat tests + ok <- allM (runTest out $ optTest opts) $ + concatMap (replicate (optRepeat opts)) $ concat tests when (not ok) exitFailure |