aboutsummaryrefslogtreecommitdiff
path: root/tests/Tests/Readers/Docx.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-01-15 20:42:00 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:42 +0100
commit4f6e6247f9a672770a6d7a55a3aa2709a860ff38 (patch)
treec745fed7bb50d9fdfa6cbcc2ec76b620756e4bd4 /tests/Tests/Readers/Docx.hs
parenta58369a7e650758004975084f984efb2bf3d7d68 (diff)
downloadpandoc-4f6e6247f9a672770a6d7a55a3aa2709a860ff38.tar.gz
Made `smart` extension default for pandoc markdown.
Updated tests.
Diffstat (limited to 'tests/Tests/Readers/Docx.hs')
-rw-r--r--tests/Tests/Readers/Docx.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs
index ef060b8ae..1fdb29f2e 100644
--- a/tests/Tests/Readers/Docx.hs
+++ b/tests/Tests/Readers/Docx.hs
@@ -1,7 +1,6 @@
module Tests.Readers.Docx (tests) where
-import Text.Pandoc.Options
-import Text.Pandoc.Readers.Native
+import Text.Pandoc
import Text.Pandoc.Definition
import Tests.Helpers
import Test.Framework
@@ -26,6 +25,9 @@ data NoNormPandoc = NoNormPandoc {unNoNorm :: Pandoc}
noNorm :: Pandoc -> NoNormPandoc
noNorm = NoNormPandoc
+defopts :: ReaderOptions
+defopts = def{ readerExtensions = getDefaultExtensions "docx" }
+
instance ToString NoNormPandoc where
toString d = purely (writeNative def{ writerTemplate = s }) $ toPandoc d
where s = case d of
@@ -57,7 +59,7 @@ testCompareWithOpts opts name docxFile nativeFile =
buildTest $ testCompareWithOptsIO opts name docxFile nativeFile
testCompare :: String -> FilePath -> FilePath -> Test
-testCompare = testCompareWithOpts def
+testCompare = testCompareWithOpts defopts
testForWarningsWithOptsIO :: ReaderOptions -> String -> FilePath -> [String] -> IO Test
testForWarningsWithOptsIO opts name docxFile expected = do
@@ -70,7 +72,7 @@ testForWarningsWithOpts opts name docxFile expected =
buildTest $ testForWarningsWithOptsIO opts name docxFile expected
-- testForWarnings :: String -> FilePath -> [String] -> Test
--- testForWarnings = testForWarningsWithOpts def
+-- testForWarnings = testForWarningsWithOpts defopts
getMedia :: FilePath -> FilePath -> IO (Maybe B.ByteString)
getMedia archivePath mediaPath = do
@@ -95,7 +97,7 @@ compareMediaPathIO mediaPath mediaBag docxPath = do
compareMediaBagIO :: FilePath -> IO Bool
compareMediaBagIO docxFile = do
df <- B.readFile docxFile
- mb <- runIOorExplode (readDocx def df >> P.getMediaBag)
+ mb <- runIOorExplode (readDocx defopts df >> P.getMediaBag)
bools <- mapM
(\(fp, _, _) -> compareMediaPathIO fp mb docxFile)
(mediaDirectory mb)