@@ -34,55 +34,60 @@ infix 4 =:
3434(=:) = test html
3535
3636tests :: [TestTree]
37−tests = [ testGroup "inline code"
38− [ "basic" =: code "@&" =?> "<code>@&</code>"
39− , "haskell" =: codeWith ("",["haskell"],[]) ">>="
40− =?> "<code class=\"sourceCode haskell\"><span class=\"op\">>>=</span></code>"
41− , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
42− =?> "<code class=\"nolanguage\">>>=</code>"
43− ]
44− , testGroup "images"
45− [ "alt with formatting" =:
46− image "/url" "title" ("my " <> emph "image")
47− =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
48− ]
49− , testGroup "blocks"
50− [ "definition list with empty <dt>" =:
51− definitionList [(mempty, [para $ text "foo bar"])]
52− =?> "<dl><dt></dt><dd><p>foo bar</p></dd></dl>"
53− ]
54− , testGroup "quotes"
55− [ "quote with cite attribute (without q-tags)" =:
56− doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
57− =?> "“<span cite=\"http://example.org\">examples</span>”"
58− , tQ "quote with cite attribute (with q-tags)" $
59− doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
60− =?> "<q cite=\"http://example.org\">examples</q>"
61− ]
62− , testGroup "sample"
63− [ "sample should be rendered correctly" =:
64− plain (codeWith ("",["sample"],[]) "Answer is 42") =?>
65− "<samp>Answer is 42</samp>"
66− ]
67− , testGroup "variable"
68− [ "variable should be rendered correctly" =:
69− plain (codeWith ("",["variable"],[]) "result") =?>
70− "<var>result</var>"
71− ]
72− , testGroup "sample with style"
73− [ "samp should wrap highlighted code" =:
74− codeWith ("",["sample","haskell"],[]) ">>="
75− =?> ("<samp><code class=\"sourceCode haskell\">" ++
76− "<span class=\"op\">>>=</span></code></samp>")
77− ]
78− , testGroup "variable with style"
79− [ "var should wrap highlighted code" =:
80− codeWith ("",["haskell","variable"],[]) ">>="
81− =?> ("<var><code class=\"sourceCode haskell\">" ++
82− "<span class=\"op\">>>=</span></code></var>")
83− ]
84− ]
85− where
86− tQ :: (ToString a, ToPandoc a)
87− => String -> (a, String) -> TestTree
88− tQ = test htmlQTags
37+tests =
38+ [ testGroup "inline code"
39+ [ "basic" =: code "@&" =?> "<code>@&</code>"
40+ , "haskell" =: codeWith ("",["haskell"],[]) ">>="
41+ =?> "<code class=\"sourceCode haskell\"><span class=\"op\">>>=</span></code>"
42+ , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
43+ =?> "<code class=\"nolanguage\">>>=</code>"
44+ ]
45+ , testGroup "images"
46+ [ "alt with formatting" =:
47+ image "/url" "title" ("my " <> emph "image")
48+ =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
49+ ]
50+ , testGroup "blocks"
51+ [ "definition list with empty <dt>" =:
52+ definitionList [(mempty, [para $ text "foo bar"])]
53+ =?> "<dl><dt></dt><dd><p>foo bar</p></dd></dl>"
54+ , "heading with disallowed attributes" =:
55+ headerWith ("", [], [("invalid","1"), ("lang", "en")]) 1 "test"
56+ =?>
57+ "<h1 lang=\"en\">test</h1>"
58+ ]
59+ , testGroup "quotes"
60+ [ "quote with cite attribute (without q-tags)" =:
61+ doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
62+ =?> "“<span cite=\"http://example.org\">examples</span>”"
63+ , tQ "quote with cite attribute (with q-tags)" $
64+ doubleQuoted (spanWith ("", [], [("cite", "http://example.org")]) (str "examples"))
65+ =?> "<q cite=\"http://example.org\">examples</q>"
66+ ]
67+ , testGroup "sample"
68+ [ "sample should be rendered correctly" =:
69+ plain (codeWith ("",["sample"],[]) "Answer is 42") =?>
70+ "<samp>Answer is 42</samp>"
71+ ]
72+ , testGroup "variable"
73+ [ "variable should be rendered correctly" =:
74+ plain (codeWith ("",["variable"],[]) "result") =?>
75+ "<var>result</var>"
76+ ]
77+ , testGroup "sample with style"
78+ [ "samp should wrap highlighted code" =:
79+ codeWith ("",["sample","haskell"],[]) ">>="
80+ =?> ("<samp><code class=\"sourceCode haskell\">" ++
81+ "<span class=\"op\">>>=</span></code></samp>")
82+ ]
83+ , testGroup "variable with style"
84+ [ "var should wrap highlighted code" =:
85+ codeWith ("",["haskell","variable"],[]) ">>="
86+ =?> ("<var><code class=\"sourceCode haskell\">" ++
87+ "<span class=\"op\">>>=</span></code></var>")
88+ ]
89+ ]
90+ where
91+ tQ :: (ToString a, ToPandoc a)
92+ => String -> (a, String) -> TestTree
93+ tQ = test htmlQTags