aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2020-04-17 17:28:55 -0700
committerJohn MacFarlane <[email protected]>2020-04-17 22:55:44 -0700
commit3eb9e1b8bd6eec9b96ab1da230b90d635970607e (patch)
treedab56cee01110319f9f981c55aeb9e0f9993cac0 /test
parent8f40b4ba14fce10199a059a281c9bd10c884241d (diff)
Fooling around with a new setup for Text.Pandoc.Data.initialize-data-files
It is Now an exported module, exporting initializeDataFiles which must be run in PandocMonad if you are going to be looking for any data files. The point of this is to decouple pandoc's data from "pandoc-core," including the infrastructure for PandocMonad.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Command.hs4
-rw-r--r--test/Tests/Writers/OOXML.hs5
2 files changed, 6 insertions, 3 deletions
diff --git a/test/Tests/Command.hs b/test/Tests/Command.hs
index e0c5a8408..ac5050163 100644
--- a/test/Tests/Command.hs
+++ b/test/Tests/Command.hs
@@ -100,8 +100,8 @@ runCommandTest pandocpath num code =
extractCommandTest :: FilePath -> FilePath -> TestTree
extractCommandTest pandocpath fp = unsafePerformIO $ do
contents <- UTF8.toText <$> BS.readFile ("command" </> fp)
- Pandoc _ blocks <- runIOorExplode (readMarkdown
- def{ readerExtensions = pandocExtensions } contents)
+ Pandoc _ blocks <- runIOorExplode $
+ readMarkdown def{ readerExtensions = pandocExtensions } contents
let codeblocks = map extractCode $ filter isCodeBlock blocks
let cases = zipWith (runCommandTest pandocpath) [1..] codeblocks
return $ testGroup fp cases
diff --git a/test/Tests/Writers/OOXML.hs b/test/Tests/Writers/OOXML.hs
index f2762ddfe..509f5d6a8 100644
--- a/test/Tests/Writers/OOXML.hs
+++ b/test/Tests/Writers/OOXML.hs
@@ -56,7 +56,10 @@ testArchive :: (WriterOptions -> Pandoc -> PandocIO BL.ByteString)
-> IO Archive
testArchive writerFn opts fp = do
txt <- T.readFile fp
- bs <- runIOorExplode $ readNative def txt >>= writerFn opts
+ bs <- runIOorExplode $ do
+ initializeDataFiles
+ setUserDataDir (Just "../data")
+ readNative def txt >>= writerFn opts
return $ toArchive bs
compareFileList :: FilePath -> Archive -> Archive -> Maybe String