git.iko.soy/typeable/pandoc
on master help sign in
ConTeXt writer tests: keep code lines below 80 chars.
d3ca486Albert Krewinkel
test/Tests/Writers/ConTeXt.hs+119−113
@@ -39,116 +39,122 @@ infix 4 =:
39(=:) = test context
39(=:) = test context
40
40
41tests :: [TestTree]
41tests :: [TestTree]
42+tests =
42−tests = [ testGroup "inline code"
43+ [ testGroup "inline code"
43− [ "with '}'" =: code "}" =?> "\\mono{\\}}"
44+ [ "with '}'" =: code "}" =?> "\\mono{\\}}"
44− , "without '}'" =: code "]" =?> "\\type{]}"
45+ , "without '}'" =: code "]" =?> "\\type{]}"
45− , testProperty "code property" $ \s -> null s || '\n' `elem` s ||
46+ , testProperty "code property" $ \s -> null s || '\n' `elem` s ||
46− if '{' `elem` s || '}' `elem` s
47+ if '{' `elem` s || '}' `elem` s
47− then context' (code $ pack s) == "\\mono{" ++
48+ then context' (code $ pack s) == "\\mono{" ++
48− context' (str $ pack s) ++ "}"
49+ context' (str $ pack s) ++ "}"
49− else context' (code $ pack s) == "\\type{" ++ s ++ "}"
50+ else context' (code $ pack s) == "\\type{" ++ s ++ "}"
50− ]
51+ ]
51− , testGroup "headers"
52+ , testGroup "headers"
52− [ "level 1" =:
53+ [ "level 1" =:
54+ headerWith ("my-header",[],[]) 1 "My header" =?>
53− headerWith ("my-header",[],[]) 1 "My header" =?> "\\section[title={My header},reference={my-header}]"
55+ "\\section[title={My header},reference={my-header}]"
54− , test contextDiv "section-divs" $
56+ , test contextDiv "section-divs" $
55− ( headerWith ("header1", [], []) 1 (text "Header1")
57+ ( headerWith ("header1", [], []) 1 (text "Header1")
56− <> headerWith ("header2", [], []) 2 (text "Header2")
58+ <> headerWith ("header2", [], []) 2 (text "Header2")
57− <> headerWith ("header3", [], []) 3 (text "Header3")
59+ <> headerWith ("header3", [], []) 3 (text "Header3")
58− <> headerWith ("header4", [], []) 4 (text "Header4")
60+ <> headerWith ("header4", [], []) 4 (text "Header4")
59− <> headerWith ("header5", [], []) 5 (text "Header5")
61+ <> headerWith ("header5", [], []) 5 (text "Header5")
60− <> headerWith ("header6", [], []) 6 (text "Header6"))
62+ <> headerWith ("header6", [], []) 6 (text "Header6"))
61− =?>
63+ =?>
64+ unlines
62− unlines [ "\\startsection[title={Header1},reference={header1}]\n"
65+ [ "\\startsection[title={Header1},reference={header1}]\n"
63− , "\\startsubsection[title={Header2},reference={header2}]\n"
66+ , "\\startsubsection[title={Header2},reference={header2}]\n"
64− , "\\startsubsubsection[title={Header3},reference={header3}]\n"
67+ , "\\startsubsubsection[title={Header3},reference={header3}]\n"
65− , "\\startsubsubsubsection[title={Header4},reference={header4}]\n"
68+ , "\\startsubsubsubsection[title={Header4},reference={header4}]\n"
66− , "\\startsubsubsubsubsection[title={Header5},reference={header5}]\n"
69+ , "\\startsubsubsubsubsection[title={Header5},reference={header5}]\n"
67− , "\\startsubsubsubsubsubsection[title={Header6},reference={header6}]\n"
70+ , "\\startsubsubsubsubsubsection[title={Header6},reference={header6}]\n"
68− , "\\stopsubsubsubsubsubsection\n"
71+ , "\\stopsubsubsubsubsubsection\n"
69− , "\\stopsubsubsubsubsection\n"
72+ , "\\stopsubsubsubsubsection\n"
70− , "\\stopsubsubsubsection\n"
73+ , "\\stopsubsubsubsection\n"
71− , "\\stopsubsubsection\n"
74+ , "\\stopsubsubsection\n"
72− , "\\stopsubsection\n"
75+ , "\\stopsubsection\n"
73− , "\\stopsection" ]
76+ , "\\stopsection" ]
74− ]
77+ ]
75− , testGroup "bullet lists"
78+ , testGroup "bullet lists"
76− [ "nested" =:
79+ [ "nested" =:
77− bulletList [
80+ bulletList [
78− plain (text "top")
81+ plain (text "top")
79− <> bulletList [
82+ <> bulletList [
80− plain (text "next")
83+ plain (text "next")
81− <> bulletList [plain (text "bot")]
84+ <> bulletList [plain (text "bot")]
82− ]
85+ ]
83− ] =?> unlines
86+ ] =?> unlines
84− [ "\\startitemize[packed]"
87+ [ "\\startitemize[packed]"
85− , "\\item"
88+ , "\\item"
86− , " top"
89+ , " top"
87− , " \\startitemize[packed]"
90+ , " \\startitemize[packed]"
88− , " \\item"
91+ , " \\item"
89− , " next"
92+ , " next"
90− , " \\startitemize[packed]"
93+ , " \\startitemize[packed]"
91− , " \\item"
94+ , " \\item"
92− , " bot"
95+ , " bot"
93− , " \\stopitemize"
96+ , " \\stopitemize"
94− , " \\stopitemize"
97+ , " \\stopitemize"
95− , "\\stopitemize" ]
98+ , "\\stopitemize" ]
96− ]
99+ ]
97− , testGroup "natural tables"
100+ , testGroup "natural tables"
98− [ test contextNtb "table with header and caption" $
101+ [ test contextNtb "table with header and caption" $
99− let capt = text "Table 1"
102+ let capt = text "Table 1"
100− aligns = [(AlignRight, ColWidthDefault), (AlignLeft, ColWidthDefault), (AlignCenter, ColWidthDefault), (AlignDefault, ColWidthDefault)]
103+ aligns = [ (AlignRight, ColWidthDefault)
104+ , (AlignLeft, ColWidthDefault)
105+ , (AlignCenter, ColWidthDefault)
106+ , (AlignDefault, ColWidthDefault) ]
101− headers = [plain $ text "Right",
107+ headers = [plain $ text "Right",
102− plain $ text "Left",
108+ plain $ text "Left",
103− plain $ text "Center",
109+ plain $ text "Center",
104− plain $ text "Default"]
110+ plain $ text "Default"]
105− rows = [[plain $ text "1.1",
111+ rows = [[plain $ text "1.1",
106− plain $ text "1.2",
112+ plain $ text "1.2",
107− plain $ text "1.3",
113+ plain $ text "1.3",
108− plain $ text "1.4"]
114+ plain $ text "1.4"]
109− ,[plain $ text "2.1",
115+ ,[plain $ text "2.1",
110− plain $ text "2.2",
116+ plain $ text "2.2",
111− plain $ text "2.3",
117+ plain $ text "2.3",
112− plain $ text "2.4"]
118+ plain $ text "2.4"]
113− ,[plain $ text "3.1",
119+ ,[plain $ text "3.1",
114− plain $ text "3.2",
120+ plain $ text "3.2",
115− plain $ text "3.3",
121+ plain $ text "3.3",
116− plain $ text "3.4"]]
122+ plain $ text "3.4"]]
117− toRow = Row nullAttr . map simpleCell
123+ toRow = Row nullAttr . map simpleCell
118− in table (simpleCaption $ plain capt)
124+ in table (simpleCaption $ plain capt)
119− aligns
125+ aligns
120− (TableHead nullAttr [toRow headers])
126+ (TableHead nullAttr [toRow headers])
121− [TableBody nullAttr 0 [] $ map toRow rows]
127+ [TableBody nullAttr 0 [] $ map toRow rows]
122− (TableFoot nullAttr [])
128+ (TableFoot nullAttr [])
123− =?> unlines [ "\\startplacetable[title={Table 1}]"
129+ =?> unlines [ "\\startplacetable[title={Table 1}]"
124− , "\\startTABLE"
130+ , "\\startTABLE"
125− , "\\startTABLEhead"
131+ , "\\startTABLEhead"
126− , "\\NC[align=left] Right"
132+ , "\\NC[align=left] Right"
127− , "\\NC[align=right] Left"
133+ , "\\NC[align=right] Left"
128− , "\\NC[align=middle] Center"
134+ , "\\NC[align=middle] Center"
129− , "\\NC Default"
135+ , "\\NC Default"
130− , "\\NC\\NR"
136+ , "\\NC\\NR"
131− , "\\stopTABLEhead"
137+ , "\\stopTABLEhead"
132− , "\\startTABLEbody"
138+ , "\\startTABLEbody"
133− , "\\NC[align=left] 1.1"
139+ , "\\NC[align=left] 1.1"
134− , "\\NC[align=right] 1.2"
140+ , "\\NC[align=right] 1.2"
135− , "\\NC[align=middle] 1.3"
141+ , "\\NC[align=middle] 1.3"
136− , "\\NC 1.4"
142+ , "\\NC 1.4"
137− , "\\NC\\NR"
143+ , "\\NC\\NR"
138− , "\\NC[align=left] 2.1"
144+ , "\\NC[align=left] 2.1"
139− , "\\NC[align=right] 2.2"
145+ , "\\NC[align=right] 2.2"
140− , "\\NC[align=middle] 2.3"
146+ , "\\NC[align=middle] 2.3"
141− , "\\NC 2.4"
147+ , "\\NC 2.4"
142− , "\\NC\\NR"
148+ , "\\NC\\NR"
143− , "\\stopTABLEbody"
149+ , "\\stopTABLEbody"
144− , "\\startTABLEfoot"
150+ , "\\startTABLEfoot"
145− , "\\NC[align=left] 3.1"
151+ , "\\NC[align=left] 3.1"
146− , "\\NC[align=right] 3.2"
152+ , "\\NC[align=right] 3.2"
147− , "\\NC[align=middle] 3.3"
153+ , "\\NC[align=middle] 3.3"
148− , "\\NC 3.4"
154+ , "\\NC 3.4"
149− , "\\NC\\NR"
155+ , "\\NC\\NR"
150− , "\\stopTABLEfoot"
156+ , "\\stopTABLEfoot"
151− , "\\stopTABLE"
157+ , "\\stopTABLE"
152− , "\\stopplacetable" ]
158+ , "\\stopplacetable" ]
153− ]
159+ ]
154− ]
160+ ]