diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2017-10-28 18:13:51 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2017-10-28 21:08:48 +0300 |
commit | d99776ea0405143d1b95f740a68b2a67cb0e73dd (patch) | |
tree | 1c1fffa4653f278c5543e0537c77f9eb6aa331b6 /test/Tests/Writers | |
parent | b39f782c8d333eda8c7560eea9e8468e04676321 (diff) | |
download | pandoc-d99776ea0405143d1b95f740a68b2a67cb0e73dd.tar.gz |
Add new style FB2 tests
Diffstat (limited to 'test/Tests/Writers')
-rw-r--r-- | test/Tests/Writers/FB2.hs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Tests/Writers/FB2.hs b/test/Tests/Writers/FB2.hs new file mode 100644 index 000000000..77ab4a82c --- /dev/null +++ b/test/Tests/Writers/FB2.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE OverloadedStrings #-} +module Tests.Writers.FB2 (tests) where + +import Test.Tasty +import Tests.Helpers +import Text.Pandoc +import Text.Pandoc.Arbitrary () +import Text.Pandoc.Builder + +fb2 :: String -> String +fb2 x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ++ + "<FictionBook xmlns=\"http://www.gribuser.ru/xml/fictionbook/2.0\" xmlns:l=\"http://www.w3.org/1999/xlink\"><description><title-info /><document-info><program-used>pandoc</program-used></document-info></description><body><title><p /></title><annotation><p></p></annotation><section>" ++ x ++ "</section></body></FictionBook>" + +infix 4 =: +(=:) :: (ToString a, ToPandoc a) + => String -> (a, String) -> TestTree +(=:) = test (purely (writeFB2 def) . toPandoc) + +tests :: [TestTree] +tests = [ testGroup "block elements" + ["para" =: para "Lorem ipsum cetera." + =?> fb2 "<p>Lorem ipsum cetera.</p>" + ] + , testGroup "inlines" + [ + "Emphasis" =: emph ("emphasized") + =?> fb2 "<emphasis>emphasized</emphasis>" + ] + , "bullet list" =: bulletList [ plain $ text "first" + , plain $ text "second" + , plain $ text "third" + ] + =?> fb2 "<p>\x2022 first</p><p>\x2022 second</p><p>\x2022 third</p>" + ] |