| ... |
... |
@@ -8,7 +8,6 @@ module Test.Haddock |
|
8
|
8
|
) where
|
|
9
|
9
|
|
|
10
|
10
|
import Control.Monad
|
|
11
|
|
-import qualified Data.ByteString.Char8 as BS
|
|
12
|
11
|
import qualified Data.Map.Strict as Map
|
|
13
|
12
|
import Data.Foldable (for_)
|
|
14
|
13
|
import Data.Maybe
|
| ... |
... |
@@ -211,7 +210,7 @@ checkFile cfg file = do |
|
211
|
210
|
ccfg = cfgCheckConfig cfg
|
|
212
|
211
|
dcfg = cfgDirConfig cfg
|
|
213
|
212
|
|
|
214
|
|
--- We use ByteString here to ensure that no lazy I/O is performed.
|
|
|
213
|
+-- We use readFile' here to ensure that no lazy I/O is performed.
|
|
215
|
214
|
-- This way to ensure that the reference file isn't held open in
|
|
216
|
215
|
-- case after `diffFile` (which is problematic if we need to rewrite
|
|
217
|
216
|
-- the reference file in `maybeAcceptFile`)
|
| ... |
... |
@@ -219,8 +218,8 @@ checkFile cfg file = do |
|
219
|
218
|
-- | Read the reference artifact for a test
|
|
220
|
219
|
readRef :: Config c -> FilePath -> IO (Maybe c)
|
|
221
|
220
|
readRef cfg file =
|
|
222
|
|
- ccfgRead ccfg . BS.unpack
|
|
223
|
|
- <$> BS.readFile (refFile dcfg file)
|
|
|
221
|
+ ccfgRead ccfg
|
|
|
222
|
+ <$> readFile' (refFile dcfg file)
|
|
224
|
223
|
where
|
|
225
|
224
|
ccfg = cfgCheckConfig cfg
|
|
226
|
225
|
dcfg = cfgDirConfig cfg
|
| ... |
... |
@@ -228,8 +227,8 @@ readRef cfg file = |
|
228
|
227
|
-- | Read (and clean) the test output artifact for a test
|
|
229
|
228
|
readOut :: Config c -> (DirConfig -> FilePath) -> FilePath -> IO c
|
|
230
|
229
|
readOut cfg dcfgDir file = do
|
|
231
|
|
- res <- fmap (ccfgClean ccfg file) . ccfgRead ccfg . BS.unpack
|
|
232
|
|
- <$> BS.readFile outFile
|
|
|
230
|
+ res <- fmap (ccfgClean ccfg file) . ccfgRead ccfg
|
|
|
231
|
+ <$> readFile' outFile
|
|
233
|
232
|
case res of
|
|
234
|
233
|
Just out -> return out
|
|
235
|
234
|
Nothing -> error $ "Failed to parse output file: " ++ outFile
|