@@ -22,23 +22,62 @@ tests :: [TestTree]
2222tests = [
2323 -- .SH "HEllo bbb" "aaa"" as"
2424 testGroup "Macros" [
25− "Bold" =:
26− ".B foo"
27− =?> (para $ strong "foo")
28− , "Italic" =:
29− ".I bar\n"
30− =?> (para $ emph "bar")
31− , "BoldItalic" =:
32− ".BI foo bar"
33− =?> (para $ strong $ emph $ str "foo bar")
34− , "H1" =:
35− ".SH The header\n"
36− =?> header 2 (str "The header")
37− , "H2" =:
38− ".SS The header 2"
39− =?> header 3 (str "The header 2")
40− , "Macro args" =:
41− ".B \"single arg with \"\"Q\"\"\""
42− =?> (para $ strong $ str "single arg with \"Q\"")
43− ]
25+ "Bold" =:
26+ ".B foo"
27+ =?> (para $ strong "foo")
28+ , "Italic" =:
29+ ".I bar\n"
30+ =?> (para $ emph "bar")
31+ , "BoldItalic" =:
32+ ".BI foo bar"
33+ =?> (para $ strong $ emph $ str "foo bar")
34+ , "H1" =:
35+ ".SH The header\n"
36+ =?> header 2 (str "The" <> space <> str "header")
37+ , "H2" =:
38+ ".SS \"The header 2\""
39+ =?> header 3 (str "The header 2")
40+ , "Macro args" =:
41+ ".B \"single arg with \"\"Q\"\"\""
42+ =?> (para $ strong $ str "single arg with \"Q\"")
43+ , "comment" =:
44+ ".\\\"bla\naaa"
45+ =?> (para $ space <> str "aaa")
46+ , "link" =:
47+ ".BR aa (1)"
48+ =?> (para $ fromList [Link nullAttr [Strong [Str "aa"]] ("../1/aa.1","aa"), Strong [Str " (1)",Str ""]])
49+ ],
50+ testGroup "Escapes" [
51+ "fonts" =:
52+ "aa\\fIbb\\fRcc"
53+ =?> (para $ str "aa" <> (emph $ str "bb") <> str "cc")
54+ , "skip" =:
55+ "a\\%\\{\\}\\\n\\:b\\0"
56+ =?> (para $ fromList $ map Str ["a", "b"])
57+ , "replace" =:
58+ "\\-\\ \\\\\\[lq]\\[rq]\\[em]\\[en]\\*(lq\\*(rq"
59+ =?> (para $ fromList $ map Str ["-", " ", "\\", "“", "”", "—", "–", "«", "»"])
60+ , "replace2" =:
61+ "\\t\\e\\`\\^\\|\\'"
62+ =?> (para $ fromList $ map Str ["\t", "\\", "`", " ", " ", "`"])
63+ ],
64+ testGroup "Lists" [
65+ "bullet" =:
66+ ".IP\nfirst\n.IP\nsecond"
67+ =?> bulletList [plain $ str "first", plain $ str "second"]
68+ , "odrered" =:
69+ ".IP 1 a\nfirst\n.IP 2 a\nsecond"
70+ =?> orderedListWith (1,Decimal,DefaultDelim) [plain $ str "first", plain $ str "second"]
71+ , "upper" =:
72+ ".IP A a\nfirst\n.IP B a\nsecond"
73+ =?> orderedListWith (1,UpperAlpha,DefaultDelim) [plain $ str "first", plain $ str "second"]
74+ , "nested" =:
75+ ".IP\nfirst\n.RS\n.IP\n1a\n.IP\n1b\n.RE"
76+ =?> fromList [BulletList [[Plain [Str "first"],BulletList [[Plain [Str "1a"]],[Plain [Str "1b"]]]]]]
77+ ],
78+ testGroup "CodeBlocks" [
79+ "cb1"=:
80+ ".nf\naa\n\tbb\n.fi"
81+ =?> codeBlock "aa\n\tbb"
82+ ]
4483 ]