summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-30 11:36:17 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-09-03 20:53:42 +0200
commite1b7b08d398765676a1169fa4a1c0463b19f71d1 (patch)
treee8e5fa4691b17aeb49adfa43113424ef6565da66 /src/Main.hs
parent8ae0a8f9b40977807ffc6c5dc1c31ac1192b008e (diff)
Gather and report test times
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 8c50bce..88fa4ba 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -8,6 +8,7 @@ import Data.Maybe
import Data.Text (Text)
import Data.Text qualified as T
+import Text.Printf
import Text.Read (readMaybe)
import System.Console.GetOpt
@@ -218,20 +219,23 @@ main = do
Report {..} <- runTests out topts lmGlobalDefs tests
when (optReport opts) $ flip runReaderT out $ do
- outLineF OutputGlobalSummary Nothing $ "Total: " <> plainText (T.pack (show reportTotalCount))
+ outLineF OutputGlobalSummary Nothing $ "Total tests: " <> plainText (T.pack (show reportTotalCount))
+ let ( mins, secs ) = (floor reportTotalTime :: Integer) `quotRem` 60
+ csecs = floor (reportTotalTime * 100) `rem` 100 :: Integer
+ outLineF OutputGlobalSummary Nothing $ "Total time: " <> plainText (T.pack $ printf "%d:%02d.%02d" mins secs csecs)
outLineF OutputGlobalSummary Nothing $ mconcat
- [ "Passed: "
+ [ "Passed tests: "
, withStyle (if (reportPassedCount > 0) then setForegroundColor Green noStyle else noStyle) $
plainText $ T.pack $ show reportPassedCount
]
outLineF OutputGlobalSummary Nothing $ mconcat
- [ "Failed: "
+ [ "Failed tests: "
, withStyle (if (reportFailedCount > 0) then setForegroundColor Red noStyle else noStyle) $
plainText (T.pack (show reportFailedCount))
]
when (reportFailedCount > 0) $ do
outLine OutputGlobalSummary Nothing ""
- outLineF OutputGlobalSummary Nothing $ withStyle (setForegroundColor BrightRed noStyle) $ "Failing tests:"
+ outLineF OutputGlobalSummary Nothing $ withStyle (setForegroundColor BrightRed noStyle) $ "Failed tests:"
forM_ reportFailedList $ \tname -> do
outLineF OutputGlobalSummary Nothing $
withStyle (setForegroundColor Red noStyle) $