diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-08-23 18:55:08 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-08-23 18:55:08 +0000 |
commit | a23f8ba5bdd6bc4da9f3c13d469477c801b020d7 (patch) | |
tree | f4d59e2af6d8239d6a2770668ae6bf6249a7d27b | |
parent | 23232785769a0dda5a73aa9e17a2ebb7d95277a0 (diff) | |
download | pandoc-a23f8ba5bdd6bc4da9f3c13d469477c801b020d7.tar.gz |
Bugs fixed in RunTests.hs:
+ 'r' -> '\r'
+ use a strict version of readFile to make sure file is closed
and can be removed
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1413 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | tests/RunTests.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/RunTests.hs b/tests/RunTests.hs index 16ee30f7f..6579077f1 100644 --- a/tests/RunTests.hs +++ b/tests/RunTests.hs @@ -81,6 +81,11 @@ main = do putStrLn $ "\n" ++ show failures ++ " tests failed." exitWith (ExitFailure failures) +-- makes sure file is fully closed after reading +readFile' :: FilePath -> IO String +readFile' f = do s <- readFile f + return $! (length s `seq` s) + runWriterTest :: String -> IO Bool runWriterTest format = do r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format) @@ -107,8 +112,8 @@ runTest testname opts inp norm = do result <- if ec == ExitSuccess then do -- filter \r so the tests will work on Windows machines - outputContents <- readFile outputPath >>= return . filter (/='r') - normContents <- readFile normPath >>= return . filter (/='r') + outputContents <- readFile' outputPath >>= return . filter (/='\r') + normContents <- readFile' normPath >>= return . filter (/='\r') if outputContents == normContents then return TestPassed else return $ TestFailed $ getDiff (lines outputContents) (lines normContents) |