aboutsummaryrefslogtreecommitdiff
path: root/haddock-test/src/Test
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-08-16 12:41:47 +1000
committerYuchen Pei <hi@ypei.me>2022-08-16 12:41:47 +1000
commit9c7202515e216826d10854a4c95c050b97551066 (patch)
treed46f4e258c523fdf857a274220658bd84ff22925 /haddock-test/src/Test
parent4a2ad11155014bcf13a7dbd7f6b9e2c530ac3b79 (diff)
parent4248704596d01753c9a776ebedf5cc598a883e28 (diff)
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'haddock-test/src/Test')
-rw-r--r--haddock-test/src/Test/Haddock.hs8
-rw-r--r--haddock-test/src/Test/Haddock/Xhtml.hs3
2 files changed, 6 insertions, 5 deletions
diff --git a/haddock-test/src/Test/Haddock.hs b/haddock-test/src/Test/Haddock.hs
index 1019e815..fe547ad5 100644
--- a/haddock-test/src/Test/Haddock.hs
+++ b/haddock-test/src/Test/Haddock.hs
@@ -89,9 +89,9 @@ runHaddock cfg@(Config { .. }) = do
, pure $ "--odir=" ++ outDir cfgDirConfig tpkg
, tpkgFiles tpkg
]
- , pcEnv = Just $ cfgEnv
- , pcStdOut = Just $ haddockStdOut
- , pcStdErr = Just $ haddockStdOut
+ , pcEnv = Just cfgEnv
+ , pcStdOut = Just haddockStdOut
+ , pcStdErr = Just haddockStdOut
}
let msg = "Failed to run Haddock on test package '" ++ tpkgName tpkg ++ "'"
@@ -159,7 +159,7 @@ diffFile cfg diff file = do
hFlush stdout
handle <- runProcess' diff $ processConfig
{ pcArgs = [outFile', refFile']
- , pcStdOut = Just $ stdout
+ , pcStdOut = Just stdout
}
waitForProcess handle >> return ()
where
diff --git a/haddock-test/src/Test/Haddock/Xhtml.hs b/haddock-test/src/Test/Haddock/Xhtml.hs
index bca2c4cc..74d8c4f7 100644
--- a/haddock-test/src/Test/Haddock/Xhtml.hs
+++ b/haddock-test/src/Test/Haddock/Xhtml.hs
@@ -23,8 +23,9 @@ import Data.Char ( isSpace )
newtype Xml = Xml { unXml :: String }
-- | Part of parsing involves dropping the @DOCTYPE@ line
+-- and windows newline endings
parseXml :: String -> Maybe Xml
-parseXml = Just . Xml . dropDocTypeLine
+parseXml = Just . Xml . filter (/= '\r') . dropDocTypeLine
where
dropDocTypeLine bs
| "<!DOCTYPE" `isPrefixOf` bs