From e1b7b08d398765676a1169fa4a1c0463b19f71d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 30 Aug 2026 11:36:17 +0200 Subject: Gather and report test times --- src/Main.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Main.hs') 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) $ -- cgit v1.2.3