aboutsummaryrefslogtreecommitdiff
path: root/haddock-test
diff options
context:
space:
mode:
authorYuji Yamamoto <whosekiteneverfly@gmail.com>2017-07-04 05:37:58 +0900
committerAlex Biehl <alexbiehl@gmail.com>2017-07-03 22:37:58 +0200
commit58edf9f5757daadeeaa7879785c48363fa154996 (patch)
treef09972ba98497c06dccea65f513877efb10ba848 /haddock-test
parenta330da5297106ff214cbb5e74965d9d1ef9dab7b (diff)
Fix test failures on Windows (#564)
* Ignore .stack-work * Fix for windows: use nul instead of /dev/null * Fix for windows: canonicalize line separator * Also normalize osx line endings
Diffstat (limited to 'haddock-test')
-rw-r--r--haddock-test/haddock-test.cabal2
-rw-r--r--haddock-test/src/Test/Haddock/Config.hs10
-rw-r--r--haddock-test/src/Test/Haddock/Utils.hs7
3 files changed, 17 insertions, 2 deletions
diff --git a/haddock-test/haddock-test.cabal b/haddock-test/haddock-test.cabal
index ef928e78..56dd1845 100644
--- a/haddock-test/haddock-test.cabal
+++ b/haddock-test/haddock-test.cabal
@@ -21,8 +21,8 @@ library
exposed-modules:
Test.Haddock
Test.Haddock.Config
+ Test.Haddock.Utils
Test.Haddock.Xhtml
other-modules:
Test.Haddock.Process
- Test.Haddock.Utils
diff --git a/haddock-test/src/Test/Haddock/Config.hs b/haddock-test/src/Test/Haddock/Config.hs
index 50616c7f..988636e4 100644
--- a/haddock-test/src/Test/Haddock/Config.hs
+++ b/haddock-test/src/Test/Haddock/Config.hs
@@ -193,7 +193,7 @@ loadConfig ccfg dcfg flags files = do
, baseDependencies ghcPath
]
- let cfgHaddockStdOut = fromMaybe "/dev/null" (flagsHaddockStdOut flags)
+ let cfgHaddockStdOut = fromMaybe defaultStdOut (flagsHaddockStdOut flags)
cfgDiffTool <- if FlagNoDiff `elem` flags
then pure Nothing
@@ -256,6 +256,14 @@ defaultDiffTool =
isAvailable = liftM isJust . findProgramLocation silent
+defaultStdOut :: FilePath
+#ifdef mingw32_HOST_OS
+defaultStdOut = "nul"
+#else
+defaultStdOut = "/dev/null"
+#endif
+
+
processFileArgs :: DirConfig -> [String] -> IO [TestPackage]
processFileArgs dcfg [] =
processFileArgs' dcfg . filter isValidEntry =<< getDirectoryContents srcDir
diff --git a/haddock-test/src/Test/Haddock/Utils.hs b/haddock-test/src/Test/Haddock/Utils.hs
index a947fea1..58408aaf 100644
--- a/haddock-test/src/Test/Haddock/Utils.hs
+++ b/haddock-test/src/Test/Haddock/Utils.hs
@@ -48,3 +48,10 @@ copyFile' :: FilePath -> FilePath -> IO ()
copyFile' old new = do
createDirectoryIfMissing True $ takeDirectory new
copyFile old new
+
+
+crlfToLf :: String -> String
+crlfToLf "" = ""
+crlfToLf ('\r' : '\n' : rest) = '\n' : crlfToLf rest
+crlfToLf ('\r' : rest) = '\n' : crlfToLf rest
+crlfToLf (other : rest) = other : crlfToLf rest