aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Old.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-22 11:30:07 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-22 11:30:07 -0800
commit80fde18fb1d983b938476ed5b3771ed5d6158d44 (patch)
tree9c2f3bbe6c1f28425b65a564df95ba39ef16537a /test/Tests/Old.hs
parent607c014e9d7a7cee0b5f82efb6b6cb80ab75ec18 (diff)
downloadpandoc-80fde18fb1d983b938476ed5b3771ed5d6158d44.tar.gz
Text.Pandoc.UTF8: change IO functions to return Text, not String.
[API change] This affects `readFile`, `getContents`, `writeFileWith`, `writeFile`, `putStrWith`, `putStr`, `putStrLnWith`, `putStrLn`. `hPutStrWith`, `hPutStr`, `hPutStrLnWith`, `hPutStrLn`, `hGetContents`. This avoids the need to uselessly create a linked list of characters when emiting output.
Diffstat (limited to 'test/Tests/Old.hs')
-rw-r--r--test/Tests/Old.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/Tests/Old.hs b/test/Tests/Old.hs
index 17ece49fd..160086be2 100644
--- a/test/Tests/Old.hs
+++ b/test/Tests/Old.hs
@@ -22,6 +22,7 @@ import Test.Tasty (TestTree, testGroup)
import Test.Tasty.Golden.Advanced (goldenTest)
import Tests.Helpers hiding (test)
import qualified Text.Pandoc.UTF8 as UTF8
+import qualified Data.Text as T
tests :: FilePath -> [TestTree]
tests pandocPath =
@@ -231,7 +232,7 @@ tests pandocPath =
-- makes sure file is fully closed after reading
readFile' :: FilePath -> IO String
readFile' f = do s <- UTF8.readFile f
- return $! (length s `seq` s)
+ return $! (T.length s `seq` T.unpack s)
lhsWriterTests :: FilePath -> String -> [TestTree]
lhsWriterTests pandocPath format
@@ -333,7 +334,7 @@ testWithNormalize normalizer pandocPath testname opts inp norm =
$ UTF8.toStringLazy out
-- filter \r so the tests will work on Windows machines
else fail $ "Pandoc failed with error code " ++ show ec
- updateGolden = UTF8.writeFile norm
+ updateGolden = UTF8.writeFile norm . T.pack
options = ["--data-dir=../data","--quiet"] ++ [inp] ++ opts
compareValues :: FilePath -> [String] -> String -> String -> IO (Maybe String)