From a44406e96d17790a82708b36f8214b4b58d44ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 24 Aug 2026 21:59:35 +0200 Subject: Move repeat and keep-going options to TestOptions --- src/Main.hs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/Main.hs') 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 }) "") + (ReqArg (\str -> to $ \opts -> opts { optRepeat = read str }) "") "number of times to repeat the test(s)" , Option [ 'e' ] [ "exclude" ] (ReqArg (\str opts -> opts { optExclude = T.pack str : optExclude opts }) "") "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 -- cgit v1.2.3