Skip to content

Commit 527b83d

Browse files
committed
Add some unit tests for SILE Writer
1 parent ab36eb1 commit 527b83d

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

test/Tests/Writers/SILE.hs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,45 @@ infix 4 =:
3434
(=:) = test sile
3535

3636
tests :: [TestTree]
37-
tests = []
37+
tests = [testGroup "BlockQuote"
38+
[ "simple" =: blockQuote (para "foo") =?>
39+
"\\begin{BlockQuote}\nfoo\n\\end{BlockQuote}"
40+
]
41+
,testGroup "BulletList"
42+
[ "simple" =: bulletList [para "foo", para "bar"] =?>
43+
"\\begin{BulletList}\n\\ListItem{foo}\n\\ListItem{bar}\n\\end{BulletList}"
44+
]
45+
,testGroup "CodeBlock"
46+
[ "simple" =: codeBlock "foo" =?>
47+
"\\begin{CodeBlock}\nfoo\n\\end{CodeBlock}"
48+
, "with id" =: codeBlockWith ("bar", ["stuff"], []) "foo" =?>
49+
"\\begin[id=bar,classes=\"stuff\"]{CodeBlock}\nfoo\n\\end{CodeBlock}"
50+
]
51+
, testGroup "definition lists"
52+
[ "with internal link" =: definitionList [(link "#go" "" (str "testing"),
53+
[plain (text "hi there")])] =?>
54+
"\\begin[tight=true]{DefinitionList}\n\\term{\\pdf:link[id=go]{testing}}\n\\definition{hi there}\n\\end{DefinitionList}"
55+
]
56+
, testGroup "Header"
57+
[ "chapter" =: header 0 (text "foo") =?>
58+
"\\Header[level=0,type=chapter]{foo}"
59+
, "section" =: header 1 (text "foo") =?>
60+
"\\Header[level=1,type=section]{foo}"
61+
, "subsection" =: header 2 (text "foo") =?>
62+
"\\Header[level=2,type=subsection]{foo}"
63+
-- , "part" =: header 0 (text "foo") =?>
64+
-- "\\Header[level=-1,type=part]{foo}"
65+
, "unnumbered with id note" =:
66+
headerWith ("foo",["unnumbered"],[]) 1
67+
(text "foo" <> note (plain $ text "bar")) =?>
68+
"\\Header[id=foo,classes=\"unnumbered\",level=1,type=section]{foo\\footnote{bar}}"
69+
, "in list item" =: bulletList [header 2 (text "foo")] =?>
70+
"\\begin{BulletList}\n\\ListItem{\\Header[level=2,type=subsection]{foo}}\n\\end{BulletList}"
71+
, "in definition list item" =:
72+
definitionList [(text "foo", [header 2 (text "bar"),
73+
para $ text "baz"])] =?>
74+
"\\begin{DefinitionList}\n\\term{foo}\n\\definition{\\Header[level=2,type=subsection]{bar}\n\nbaz}\n\\end{DefinitionList}"
75+
, "containing image" =: header 1 (image "imgs/foo.jpg" "" (text "Alt text")) =?>
76+
"\\Header[level=1,type=section]{\\img[src=imgs/foo.jpg]{Alt text}}"
77+
]
78+
]

0 commit comments

Comments
 (0)