Merge pull request #1351 from jkr/testWithOptions
Add ReaderOptions to the docx tests
This commit is contained in:
commit
ceb4bb3250
1 changed files with 11 additions and 8 deletions
|
@ -8,20 +8,23 @@ 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
|
||||
compareOutput :: ReaderOptions -> FilePath -> FilePath -> IO (Pandoc, Pandoc)
|
||||
compareOutput opts docxFile nativeFile = do
|
||||
df <- B.readFile docxFile
|
||||
nf <- Prelude.readFile nativeFile
|
||||
return $ (readDocx def df, readNative nf)
|
||||
return $ (readDocx opts df, readNative nf)
|
||||
|
||||
testCompare' :: String -> FilePath -> FilePath -> IO Test
|
||||
testCompare' name docxFile nativeFile = do
|
||||
(dp, np) <- compareOutput docxFile nativeFile
|
||||
testCompareWithOptsIO :: ReaderOptions -> String -> FilePath -> FilePath -> IO Test
|
||||
testCompareWithOptsIO opts name docxFile nativeFile = do
|
||||
(dp, np) <- compareOutput opts docxFile nativeFile
|
||||
return $ test id name (dp, np)
|
||||
|
||||
testCompareWithOpts :: ReaderOptions -> String -> FilePath -> FilePath -> Test
|
||||
testCompareWithOpts opts name docxFile nativeFile =
|
||||
buildTest $ testCompareWithOptsIO opts name docxFile nativeFile
|
||||
|
||||
testCompare :: String -> FilePath -> FilePath -> Test
|
||||
testCompare name docxFile nativeFile =
|
||||
buildTest $ testCompare' name docxFile nativeFile
|
||||
testCompare = testCompareWithOpts def
|
||||
|
||||
|
||||
tests :: [Test]
|
||||
|
|
Loading…
Add table
Reference in a new issue