summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-25 18:09:40 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-25 18:35:52 +0200
commitb515ae37932b800b69df3ded320e4b673ee23cea (patch)
treec9b9bf005a3d7416528f0a797ffff2d7a7808cfb /src/Main.hs
parentec493e03b0415f43968c0a04598ada3272a0f0cf (diff)
Retport summary of test execution
Changelog: Added `--report` command-line option to print summary of passed/failed tests.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs17
1 files changed, 15 insertions, 2 deletions
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