diff options
author | Yan Pashkovsky <Yanpas@users.noreply.github.com> | 2018-05-09 19:48:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-09 19:48:34 +0300 |
commit | a337685fe0ab9c63b9456f27787bbe4f0d785a94 (patch) | |
tree | e9fc4dfc0802f8acd97f06a8cc8d7c89b5a988ab /test/Tests/Readers/EPUB.hs.orig | |
parent | 8e9973b9f761262b6871206f741ac3f2a25aa6bb (diff) | |
parent | 5f33d2e0cd9f19566904c93be04f586de811dd75 (diff) | |
download | pandoc-a337685fe0ab9c63b9456f27787bbe4f0d785a94.tar.gz |
Merge branch 'master' into groff_reader
Diffstat (limited to 'test/Tests/Readers/EPUB.hs.orig')
-rw-r--r-- | test/Tests/Readers/EPUB.hs.orig | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/Tests/Readers/EPUB.hs.orig b/test/Tests/Readers/EPUB.hs.orig new file mode 100644 index 000000000..1337a9c11 --- /dev/null +++ b/test/Tests/Readers/EPUB.hs.orig @@ -0,0 +1,40 @@ +module Tests.Readers.EPUB (tests) where + +import qualified Data.ByteString.Lazy as BL +import Test.Tasty +import Test.Tasty.HUnit +import qualified Text.Pandoc.Class as P +import Text.Pandoc.MediaBag (MediaBag, mediaDirectory) +import Text.Pandoc.Options +import Text.Pandoc.Readers.EPUB + +getMediaBag :: FilePath -> IO MediaBag +getMediaBag fp = do + bs <- BL.readFile fp + P.runIOorExplode $ do + readEPUB def bs + P.getMediaBag + +testMediaBag :: FilePath -> [(String, String, Int)] -> IO () +testMediaBag fp bag = do + actBag <- mediaDirectory <$> getMediaBag fp + assertBool (show "MediaBag did not match:\nExpected: " + ++ show bag + ++ "\nActual: " + ++ show actBag) + (actBag == bag) + +featuresBag :: [(String, String, Int)] +featuresBag = [("img/check.gif","image/gif",1340) + ,("img/check.jpg","image/jpeg",2661) + ,("img/check.png","image/png",2815) + ,("img/multiscripts_and_greek_alphabet.png","image/png",10060) + ] + +tests :: [TestTree] +tests = + [ testGroup "EPUB Mediabag" + [ testCase "features bag" + (testMediaBag "epub/img.epub" featuresBag) + ] + ] |