From 5d48a62b74989cd14eb66856c8c340b8c262a473 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal <jrosenthal@jhu.edu> Date: Thu, 23 Jun 2016 10:45:14 -0400 Subject: [PATCH] Docx reader tests: Add tests for warnings. We test to see if we emit any warnings. --- tests/Tests/Readers/Docx.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs index aeb6bf939..a1315446a 100644 --- a/tests/Tests/Readers/Docx.hs +++ b/tests/Tests/Readers/Docx.hs @@ -57,6 +57,19 @@ testCompareWithOpts opts name docxFile nativeFile = testCompare :: String -> FilePath -> FilePath -> Test testCompare = testCompareWithOpts def +testForWarningsWithOptsIO :: ReaderOptions -> String -> FilePath -> [String] -> IO Test +testForWarningsWithOptsIO opts name docxFile expected = do + df <- B.readFile docxFile + let (_, _, warns) = handleError $ readDocxWithWarnings opts df + return $ test id name (unlines warns, unlines expected) + +testForWarningsWithOpts :: ReaderOptions -> String -> FilePath -> [String] -> Test +testForWarningsWithOpts opts name docxFile expected = + buildTest $ testForWarningsWithOptsIO opts name docxFile expected + +-- testForWarnings :: String -> FilePath -> [String] -> Test +-- testForWarnings = testForWarningsWithOpts def + getMedia :: FilePath -> FilePath -> IO (Maybe B.ByteString) getMedia archivePath mediaPath = do zf <- B.readFile archivePath >>= return . toArchive