summaryrefslogtreecommitdiff
path: root/tests/Tests/Writers/ConTeXt.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Tests/Writers/ConTeXt.hs')
-rw-r--r--tests/Tests/Writers/ConTeXt.hs55
1 files changed, 43 insertions, 12 deletions
diff --git a/tests/Tests/Writers/ConTeXt.hs b/tests/Tests/Writers/ConTeXt.hs
index 1a887de1f..9b59c617d 100644
--- a/tests/Tests/Writers/ConTeXt.hs
+++ b/tests/Tests/Writers/ConTeXt.hs
@@ -1,29 +1,60 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
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 -> (Inlines, String)
-inlines ils = (ils, removeTrailingSpace .
- writeConTeXt defaultWriterOptions . doc . plain $ ils)
+context :: (ToString a, ToPandoc a) => a -> String
+context = writeConTeXt defaultWriterOptions . toPandoc
-blocks :: Blocks -> (Blocks, String)
-blocks bls = (bls, writeConTeXt defaultWriterOptions . doc $ bls)
+{-
+ "my test" =: X =?> Y
+
+is shorthand for
+
+ test context "my test" $ X =?> Y
+
+which is in turn shorthand for
+
+ test context "my test" (X,Y)
+-}
+
+infix 5 =:
+(=:) :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> Test
+(=:) = test context
tests :: [Test]
tests = [ testGroup "inline code"
- [ "with '}'" =:
- inlines (code "}") --> "\\mono{\\letterclosebrace{x}}"
- , "without '}'" =:
- inlines (code "]") --> "\\type{]}"
+ [ "with '}'" =: code "}" =?> "\\mono{\\letterclosebrace{}}"
+ , "without '}'" =: code "]" =?> "\\type{]}"
]
, testGroup "headers"
[ "level 1" =:
- blocks (header 1 "My header") --> "\\subject{My header}"
+ header 1 "My header" =?> "\\subject{My header}"
+ ]
+ , testGroup "bullet lists"
+ [ "nested" =:
+ bulletList [plain (text "top")
+ ,bulletList [plain (text "next")
+ ,bulletList [plain (text "bot")]]]
+ =?> [$lit|
+\startitemize
+\item
+ top
+\item
+ \startitemize
+ \item
+ next
+ \item
+ \startitemize
+ \item
+ bot
+ \stopitemize
+ \stopitemize
+\stopitemize|]
]
]