diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-06-16 22:16:45 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-06-16 22:16:45 -0700 |
commit | bec9f3c641e1376c0ef27d3df5a7b0a3fc7eee4f (patch) | |
tree | 53c00a7038058f04f82aab2d149f0851a538156d /tests/Tests/Readers/DocX.hs | |
parent | 78ee2416d105bd25337819a49835623a8a296224 (diff) | |
parent | c709cec0bdf7a3029a43f0c46d071a7ca1ab6a13 (diff) | |
download | pandoc-bec9f3c641e1376c0ef27d3df5a7b0a3fc7eee4f.tar.gz |
Merge branch 'docx' of https://github.com/jkr/pandoc into jkr-docx
Diffstat (limited to 'tests/Tests/Readers/DocX.hs')
-rw-r--r-- | tests/Tests/Readers/DocX.hs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/Tests/Readers/DocX.hs b/tests/Tests/Readers/DocX.hs new file mode 100644 index 000000000..f4564ea1d --- /dev/null +++ b/tests/Tests/Readers/DocX.hs @@ -0,0 +1,68 @@ +module Tests.Readers.DocX (tests) where + +import Text.Pandoc.Options +import Text.Pandoc.Readers.Native +import Text.Pandoc.Definition +import Tests.Helpers +import Test.Framework +import qualified Data.ByteString.Lazy as B +import Text.Pandoc.Readers.DocX + +compareOutput :: FilePath -> FilePath -> IO (Pandoc, Pandoc) +compareOutput docxFile nativeFile = do + df <- B.readFile docxFile + nf <- Prelude.readFile nativeFile + return $ (readDocX def df, readNative nf) + +testCompare' :: String -> FilePath -> FilePath -> IO Test +testCompare' name docxFile nativeFile = do + (dp, np) <- compareOutput docxFile nativeFile + return $ test id name (dp, np) + +testCompare :: String -> FilePath -> FilePath -> Test +testCompare name docxFile nativeFile = + buildTest $ testCompare' name docxFile nativeFile + + +tests :: [Test] +tests = [ testGroup "inlines" + [ testCompare + "font formatting" + "docx.inline_formatting.docx" + "docx.inline_formatting.native" + , testCompare + "hyperlinks" + "docx.links.docx" + "docx.links.native" + , testCompare + "inline image with reference output" + "docx.image.docx" + "docx.image_no_embed.native" + , testCompare + "handling unicode input" + "docx.unicode.docx" + "docx.unicode.native"] + , testGroup "blocks" + [ testCompare + "headers" + "docx.headers.docx" + "docx.headers.native" + , testCompare + "lists" + "docx.lists.docx" + "docx.lists.native" + , testCompare + "footnotes and endnotes" + "docx.notes.docx" + "docx.notes.native" + , testCompare + "blockquotes (parsing indent as blockquote)" + "docx.block_quotes.docx" + "docx.block_quotes_parse_indent.native" + , testCompare + "tables" + "docx.tables.docx" + "docx.tables.native" + ] + ] + |