diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Tests/Helpers.hs | 5 | ||||
-rw-r--r-- | tests/Tests/Writers/ConTeXt.hs | 29 | ||||
-rw-r--r-- | tests/test-pandoc.hs | 4 |
3 files changed, 38 insertions, 0 deletions
diff --git a/tests/Tests/Helpers.hs b/tests/Tests/Helpers.hs index 6a677f7b9..f8236a54b 100644 --- a/tests/Tests/Helpers.hs +++ b/tests/Tests/Helpers.hs @@ -9,6 +9,11 @@ import Test.Framework import Test.Framework.Providers.HUnit import Test.HUnit hiding (Test) +infix 8 --> + +(-->) :: (Eq a, Show a) => a -> a -> Assertion +a --> e = assertEqual " " e a + -- In the first argument, the String is the input, and the Pandoc -- the output, of a pandoc reader. The input is shown in case -- the test fails. diff --git a/tests/Tests/Writers/ConTeXt.hs b/tests/Tests/Writers/ConTeXt.hs new file mode 100644 index 000000000..cdc98be5d --- /dev/null +++ b/tests/Tests/Writers/ConTeXt.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE OverloadedStrings #-} +module Tests.Writers.ConTeXt (tests) where + +import Test.Framework +import Text.Pandoc.Builder +import Text.Pandoc +import Text.Pandoc.Shared (removeTrailingSpace) +import Tests.Helpers + +inlines :: Inlines -> String +inlines = removeTrailingSpace . + writeConTeXt defaultWriterOptions . doc . plain + +blocks :: Blocks -> String +blocks = writeConTeXt defaultWriterOptions . doc + +tests :: [Test] +tests = [ testGroup "inline code" + [ "with '}'" =: + inlines (code "}") --> "\\mono{\\letterclosebrace{}}" + , "without '}'" =: + inlines (code "]") --> "\\type{]}" + ] + , testGroup "headers" + [ "level 1" =: + blocks (header 1 "My header") --> "\\subject{My header}" + ] + ] + diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs index 316060c83..faa2735c9 100644 --- a/tests/test-pandoc.hs +++ b/tests/test-pandoc.hs @@ -6,12 +6,16 @@ import Test.Framework import qualified Tests.Old import qualified Tests.Readers.LaTeX +import qualified Tests.Writers.ConTeXt tests :: [Test] tests = [ testGroup "Old" Tests.Old.tests , testGroup "Readers" [ testGroup "LaTeX" Tests.Readers.LaTeX.tests ] + , testGroup "Writers" + [ testGroup "ConTeXt" Tests.Writers.ConTeXt.tests + ] ] main :: IO () |