blob: e815b4f5a909e55904cb2676bc85d8b1194ce1b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
{-# LANGUAGE OverloadedStrings #-}
module Tests.Writers.Docbook (tests) where
import Test.Framework
import Text.Pandoc.Builder
import Text.Pandoc
import Tests.Helpers
import Tests.Arbitrary()
docbook :: (ToString a, ToPandoc a) => a -> String
docbook = writeDocbook def{ writerWrapText = False } . toPandoc
{-
"my test" =: X =?> Y
is shorthand for
test docbook "my test" $ X =?> Y
which is in turn shorthand for
test docbook "my test" (X,Y)
-}
infix 4 =:
(=:) :: (ToString a, ToPandoc a)
=> String -> (a, String) -> Test
(=:) = test docbook
lineblock :: Blocks
lineblock = para ("some text" <> linebreak <>
"and more lines" <> linebreak <>
"and again")
lineblock_out :: String
lineblock_out = "<literallayout>some text\n" ++
"and more lines\n" ++
"and again</literallayout>"
tests :: [Test]
tests = [ testGroup "line blocks"
[ "none" =: para "This is a test"
=?> "<para>\n This is a test\n</para>"
, "basic" =: lineblock
=?> lineblock_out
, "blockquote" =: blockQuote lineblock
=?> ("<blockquote>\n" ++ lineblock_out ++ "\n</blockquote>")
, "footnote" =: para ("This is a test" <> note lineblock <> " of footnotes")
=?> ("<para>\n This is a test<footnote>\n" ++
lineblock_out ++
"\n </footnote> of footnotes\n</para>")
]
]
|