From 359ddc68ea519108c3cf05c7a6eaff02217e979f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 5 Sep 2026 21:00:48 +0200 Subject: Always use plain decimal notation in JUnit report times --- src/JUnit.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/JUnit.hs b/src/JUnit.hs index 3649d53..71fe3c1 100644 --- a/src/JUnit.hs +++ b/src/JUnit.hs @@ -8,6 +8,7 @@ import Data.ByteString qualified as B import Data.ByteString.Char8 qualified as BC import Data.Function import Data.List.NonEmpty qualified as NE +import Data.Scientific import Data.Text.Encoding import System.Directory @@ -18,19 +19,22 @@ import Run import Script.Var +showTime :: Scientific -> B.ByteString +showTime = BC.pack . formatScientific Fixed Nothing + writeJUnitReport :: FilePath -> Report -> IO () writeJUnitReport path Report {..} = do createDirectoryIfMissing True $ takeDirectory path withFile path WriteMode $ \h -> do B.hPutStr h $ "\n" - B.hPutStr h $ " BC.pack (show reportTotalTime) <> "\">\n" + B.hPutStr h $ " showTime reportTotalTime <> "\">\n" forM_ (NE.groupBy ((==) `on` (testNameModule . reportTestName)) reportTests) $ \grp -> do - B.hPutStr h $ " encodeUtf8 (textModuleName $ testNameModule $ reportTestName $ NE.head grp) <> "\" time=\"" <> BC.pack (show $ sum $ map reportTime $ NE.toList grp) <> "\">" + B.hPutStr h $ " encodeUtf8 (textModuleName $ testNameModule $ reportTestName $ NE.head grp) <> "\" time=\"" <> showTime (sum $ map reportTime $ NE.toList grp) <> "\">" forM_ grp $ \SingleTestReport {..} -> do B.hPutStr h $ B.concat [ " do " />" -- cgit v1.2.3