diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-08-24 21:59:35 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-08-24 21:59:35 +0200 |
| commit | a44406e96d17790a82708b36f8214b4b58d44ac6 (patch) | |
| tree | 4154270a5f3adcaa0526d359501ed47aff66c6fd /src/Main.hs | |
| parent | cab137da80bb68ea824f7a42c2d15c6cccd56c71 (diff) | |
Move repeat and keep-going options to TestOptions
Diffstat (limited to 'src/Main.hs')
| -rw-r--r-- | src/Main.hs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/Main.hs b/src/Main.hs index d3e5ce8..4e73c69 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -28,9 +28,7 @@ import Version data CmdlineOptions = CmdlineOptions { optTest :: TestOptions - , optRepeat :: Int , optExclude :: [ Text ] - , optKeepGoing :: Bool , optVerbose :: Bool , optColor :: Maybe Bool , optShowHelp :: Bool @@ -42,9 +40,7 @@ data CmdlineOptions = CmdlineOptions defaultCmdlineOptions :: CmdlineOptions defaultCmdlineOptions = CmdlineOptions { optTest = defaultTestOptions - , optRepeat = 1 , optExclude = [] - , optKeepGoing = False , optVerbose = False , optColor = Nothing , optShowHelp = False @@ -91,13 +87,13 @@ options = (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>") + (ReqArg (\str -> to $ \opts -> opts { optRepeat = read str }) "<count>") "number of times to repeat the test(s)" , Option [ 'e' ] [ "exclude" ] (ReqArg (\str opts -> opts { optExclude = T.pack str : optExclude opts }) "<test|tag>") "exclude given test or test tag from execution" , Option [] [ "keep-going" ] - (NoArg $ \opts -> opts { optKeepGoing = True }) + (NoArg $ to $ \opts -> opts { optKeepGoing = True }) "keep going after a failed test" , Option [] ["wait"] (NoArg $ to $ \opts -> opts { optWait = True }) @@ -212,15 +208,7 @@ main = do { optTcpdump = tcpdump } - let doRun (t : ts) = do - runTest out topts lmGlobalDefs t >>= \case - True -> doRun ts - False - | optKeepGoing opts -> doRun ts >> return False - | otherwise -> return False - doRun [] = return True - - ok <- doRun $ concat $ replicate (optRepeat opts) tests + ok <- runTests out topts lmGlobalDefs tests when (not ok) exitFailure exitOnError :: Either CustomTestError a -> IO a |