From 66b914a1eef9a86126cd39954c676a51e92fa182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 6 Sep 2026 10:50:17 +0200 Subject: Add standard output to the JUnit report --- src/JUnit.hs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/JUnit.hs') diff --git a/src/JUnit.hs b/src/JUnit.hs index 71fe3c1..03e07ec 100644 --- a/src/JUnit.hs +++ b/src/JUnit.hs @@ -9,6 +9,7 @@ import Data.ByteString.Char8 qualified as BC import Data.Function import Data.List.NonEmpty qualified as NE import Data.Scientific +import Data.Text qualified as T import Data.Text.Encoding import System.Directory @@ -34,15 +35,26 @@ writeJUnitReport path Report {..} = do B.hPutStr h $ B.concat [ "" + , "" + , encodeUtf8 $ escape reportOutput + , "" , case reportTestFailed of Nothing -> do - " />" + "" Just Failed -> do - ">" + "" <> encodeUtf8 (escape reportOutputError) <> "" Just (ProcessCrashed _) -> do - ">" + "" <> encodeUtf8 (escape reportOutputError) <> "" + , "" ] B.hPutStr h $ "" B.hPutStr h $ "\n" + + where + escape = T.concatMap $ \case + '&' -> "&" + '<' -> "<" + '>' -> ">" + c -> T.singleton c -- cgit v1.2.3