diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-04-25 12:41:07 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-04-25 20:19:39 -0700 |
commit | b3669e139cf354d74579b87b07b41f6d63126c84 (patch) | |
tree | cb9e2c67816ed4432d100a9b82fa3bdae0e506ff /tests | |
parent | 2afa967aded687d49b1974ed34af422d4b94b516 (diff) | |
download | pandoc-b3669e139cf354d74579b87b07b41f6d63126c84.tar.gz |
RunTests: use UTF8 no matter what the locale.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/RunTests.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/RunTests.hs b/tests/RunTests.hs index 0b5555ed1..548a81da3 100644 --- a/tests/RunTests.hs +++ b/tests/RunTests.hs @@ -13,9 +13,7 @@ -- cabal install Diff module Main where -import System.IO.UTF8 import System.IO ( openTempFile, stderr, stdout, hFlush ) -import Prelude hiding ( putStrLn, putStr, readFile ) import System.Process ( runProcess, waitForProcess ) import System.FilePath ( (</>), (<.>) ) import System.Directory @@ -23,6 +21,12 @@ import System.Environment import System.Exit import Text.Printf import Data.Algorithm.Diff +import Prelude hiding ( readFile ) +import qualified Data.ByteString.Lazy as B +import Data.ByteString.Lazy.UTF8 (toString, fromString) + +readFileUTF8 :: FilePath -> IO String +readFileUTF8 f = B.readFile f >>= return . toString pandocPath :: FilePath pandocPath = ".." </> "dist" </> "build" </> "pandoc" </> "pandoc" @@ -127,7 +131,7 @@ main = do -- makes sure file is fully closed after reading readFile' :: FilePath -> IO String -readFile' f = do s <- readFile f +readFile' f = do s <- readFileUTF8 f return $! (length s `seq` s) runLhsWriterTest :: String -> IO Bool @@ -174,5 +178,5 @@ runTest testname opts inp norm = do else return $ TestFailed $ getDiff (lines outputContents) (lines normContents) else return $ TestError ec removeFile outputPath - putStrLn (show result) + B.putStrLn (fromString $ show result) return (result == TestPassed) |