@@ -0,0 +1,41 @@
1+{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
2+module Tests.Writers.HTML (tests) where
3+
4+import Test.Framework
5+import Text.Pandoc.Builder
6+import Text.Pandoc
7+import Tests.Helpers
8+import Tests.Arbitrary()
9+import Text.Pandoc.Highlighting (languages) -- null if no hl support
10+
11+html :: (ToString a, ToPandoc a) => a -> String
12+html = writeHtmlString defaultWriterOptions{ writerWrapText = False } . toPandoc
13+
14+{-
15+ "my test" =: X =?> Y
16+
17+is shorthand for
18+
19+ test html "my test" $ X =?> Y
20+
21+which is in turn shorthand for
22+
23+ test html "my test" (X,Y)
24+-}
25+
26+infix 5 =:
27+(=:) :: (ToString a, ToPandoc a)
28+ => String -> (a, String) -> Test
29+(=:) = test html
30+
31+tests :: [Test]
32+tests = [ testGroup "inline code"
33+ [ "basic" =: code "@&" =?> "<code>@&</code>"
34+ , "haskell" =: codeWith ("",["haskell"],[]) ">>="
35+ =?> if null languages
36+ then "<code class=\"haskell\">>>=</code>"
37+ else "<code class=\"sourceCode haskell\"><span class=\"fu\">>>=</span></code>"
38+ , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
39+ =?> "<code class=\"nolanguage\">>>=</code>"
40+ ]
41+ ]