summaryrefslogtreecommitdiff
path: root/src/Tests/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-06-22 19:46:54 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2011-06-22 19:46:54 -0700
commitd324bcb0a9d9a1a474671a48baecd2c38c773060 (patch)
tree61ae36ecee4a6306267423f79d6a81eaec69c309 /src/Tests/Writers
parent39811e6d9f4ca32d763f1ff90d5f9006816d6a43 (diff)
Added Tests.Writers.Markdown.
Diffstat (limited to 'src/Tests/Writers')
-rw-r--r--src/Tests/Writers/Markdown.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Tests/Writers/Markdown.hs b/src/Tests/Writers/Markdown.hs
new file mode 100644
index 000000000..70266a683
--- /dev/null
+++ b/src/Tests/Writers/Markdown.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
+module Tests.Writers.Markdown (tests) where
+
+import Test.Framework
+import Text.Pandoc.Builder
+import Text.Pandoc
+import Tests.Helpers
+import Tests.Arbitrary()
+
+markdown :: (ToString a, ToPandoc a) => a -> String
+markdown = writeMarkdown defaultWriterOptions . toPandoc
+
+{-
+ "my test" =: X =?> Y
+
+is shorthand for
+
+ test markdown "my test" $ X =?> Y
+
+which is in turn shorthand for
+
+ test markdown "my test" (X,Y)
+-}
+
+infix 5 =:
+(=:) :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> Test
+(=:) = test markdown
+
+tests :: [Test]
+tests = [ "indented code after list"
+ =: (orderedList [ para "one" +++ para "two" ] +++ codeBlock "test")
+ =?> "1. one\n\n two\n\n<!-- -->\n\n test"
+ ]