aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Readers/EPUB.hs.orig
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-04-14 10:38:21 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-04-14 10:42:05 -0700
commitd5b98c8c6ec13556911876ac5632efb63a1ce40d (patch)
tree07b56109442090643dabc85e6023ffe3c1a7d93d /test/Tests/Readers/EPUB.hs.orig
parent488320faac36bbe9add43f2947afe16444ab23a6 (diff)
downloadpandoc-d5b98c8c6ec13556911876ac5632efb63a1ce40d.tar.gz
Man writer: Don't escape U+2019 as '.
Closes #4550.
Diffstat (limited to 'test/Tests/Readers/EPUB.hs.orig')
-rw-r--r--test/Tests/Readers/EPUB.hs.orig40
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)
+ ]
+ ]