From b515ae37932b800b69df3ded320e4b673ee23cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 25 Aug 2026 18:09:40 +0200 Subject: Retport summary of test execution Changelog: Added `--report` command-line option to print summary of passed/failed tests. --- src/Main.hs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 4e73c69..b6c1078 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -30,6 +30,7 @@ data CmdlineOptions = CmdlineOptions { optTest :: TestOptions , optExclude :: [ Text ] , optVerbose :: Bool + , optReport :: Bool , optColor :: Maybe Bool , optShowHelp :: Bool , optShowVersion :: Bool @@ -42,6 +43,7 @@ defaultCmdlineOptions = CmdlineOptions { optTest = defaultTestOptions , optExclude = [] , optVerbose = False + , optReport = False , optColor = Nothing , optShowHelp = False , optShowVersion = False @@ -95,6 +97,9 @@ options = , Option [] [ "keep-going" ] (NoArg $ to $ \opts -> opts { optKeepGoing = True }) "keep going after a failed test" + , Option [] [ "report" ] + (NoArg $ \opts -> opts { optReport = True, optTest = (optTest opts) { optKeepGoing = True } }) + "print summary of passing and failing tests (implies --keep-going)" , Option [] ["wait"] (NoArg $ to $ \opts -> opts { optWait = True }) "wait at the end of each test" @@ -208,8 +213,16 @@ main = do { optTcpdump = tcpdump } - ok <- runTests out topts lmGlobalDefs tests - when (not ok) exitFailure + Report {..} <- runTests out topts lmGlobalDefs tests + + when (optReport opts) $ do + putStrLn $ "Total: " <> show reportTotalCount + putStrLn $ "Passed: " <> show reportPassedCount + putStrLn $ "Failed: " <> show reportFailedCount + forM_ reportFailedList $ \tname -> do + putStrLn $ T.unpack $ textTestName tname + + when (reportFailedCount > 0) exitFailure exitOnError :: Either CustomTestError a -> IO a exitOnError (Left err) = do -- cgit v1.2.3