From 72f8c295ba9e6bdaf9721fe0a4e642e40e09184e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Fri, 10 Jan 2025 19:00:43 +0100 Subject: [PATCH] Build HTML report using text builder --- lib/Echidna/Output/Source.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/Echidna/Output/Source.hs b/lib/Echidna/Output/Source.hs index c2e9c2da0..bca8dcc14 100644 --- a/lib/Echidna/Output/Source.hs +++ b/lib/Echidna/Output/Source.hs @@ -15,6 +15,8 @@ import Data.Sequence qualified as Seq import Data.Set qualified as S import Data.Text (Text, pack) import Data.Text qualified as T +import Data.Text.Lazy (toStrict) +import Data.Text.Lazy.Builder (fromString, fromText, singleton, toLazyText) import Data.Text.Encoding (decodeUtf8) import Data.Text.IO (writeFile) import Data.Vector qualified as V @@ -80,7 +82,7 @@ ppCoveredCode fileType sc cs s | null s = "Coverage map is empty" ppFile (srcPath, srcLines) = let runtimeLines = fromMaybe mempty $ Map.lookup srcPath runtimeLinesMap marked = markLines fileType srcLines runtimeLines (fromMaybe Map.empty (Map.lookup srcPath covLines)) - in T.unlines (changeFileName srcPath : changeFileLines (V.toList marked)) + in changeFileName srcPath <> lazyunlines fromText (changeFileLines (V.toList marked)) topHeader = case fileType of Lcov -> "TN:\n" Html -> "