forked from gomarkdown/markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock_test.go
196 lines (158 loc) · 5.67 KB
/
block_test.go
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package markdown
import (
"testing"
"github.com/gomarkdown/markdown/html"
"github.com/gomarkdown/markdown/parser"
)
func TestPrefixHeaderNoExtensions(t *testing.T) {
tests := readTestFile2(t, "PrefixHeaderNoExtensions.tests")
doTestsBlock(t, tests, 0)
}
func TestPrefixHeaderSpaceExtension(t *testing.T) {
tests := readTestFile2(t, "PrefixHeaderSpaceExtension.tests")
doTestsBlock(t, tests, parser.SpaceHeadings)
}
func TestPrefixHeaderIdExtension(t *testing.T) {
tests := readTestFile2(t, "PrefixHeaderIdExtension.tests")
doTestsBlock(t, tests, parser.HeadingIDs)
}
func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
tests := readTestFile2(t, "PrefixHeaderIdExtensionWithPrefixAndSuffix.tests")
parameters := html.RendererOptions{
HeadingIDPrefix: "PRE:",
HeadingIDSuffix: ":POST",
}
doTestsParam(t, tests, TestParams{
extensions: parser.HeadingIDs,
Flags: html.UseXHTML,
RendererOptions: parameters,
})
}
func TestPrefixAutoHeaderIdExtension(t *testing.T) {
tests := readTestFile2(t, "PrefixAutoHeaderIdExtension.tests")
doTestsBlock(t, tests, parser.AutoHeadingIDs)
}
func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
tests := readTestFile2(t, "PrefixAutoHeaderIdExtensionWithPrefixAndSuffix.tests")
parameters := html.RendererOptions{
HeadingIDPrefix: "PRE:",
HeadingIDSuffix: ":POST",
}
doTestsParam(t, tests, TestParams{
extensions: parser.AutoHeadingIDs,
Flags: html.UseXHTML,
RendererOptions: parameters,
})
}
func TestPrefixMultipleHeaderExtensions(t *testing.T) {
tests := readTestFile2(t, "PrefixMultipleHeaderExtensions.tests")
doTestsBlock(t, tests, parser.AutoHeadingIDs|parser.HeadingIDs)
}
func TestPrefixHeaderMmarkExtension(t *testing.T) {
tests := readTestFile2(t, "PrefixHeaderMmarkExtension.tests")
doTestsBlock(t, tests, parser.Mmark)
}
func TestUnderlineHeaders(t *testing.T) {
tests := readTestFile2(t, "UnderlineHeaders.tests")
doTestsBlock(t, tests, 0)
}
func TestUnderlineHeadersAutoIDs(t *testing.T) {
tests := readTestFile2(t, "UnderlineHeadersAutoIDs.tests")
doTestsBlock(t, tests, parser.AutoHeadingIDs)
}
func TestHorizontalRule(t *testing.T) {
tests := readTestFile2(t, "HorizontalRule.tests")
doTestsBlock(t, tests, 0)
}
func TestUnorderedList(t *testing.T) {
tests := readTestFile2(t, "UnorderedList.tests")
doTestsBlock(t, tests, 0)
}
func TestOrderedList(t *testing.T) {
tests := readTestFile2(t, "OrderedList.tests")
doTestsBlock(t, tests, 0)
}
func TestDefinitionList(t *testing.T) {
tests := readTestFile2(t, "DefinitionList.tests")
doTestsBlock(t, tests, parser.DefinitionLists)
}
func TestNestedDefinitionList(t *testing.T) {
tests := readTestFile2(t, "NestedDefinitionList.tests")
doTestsBlock(t, tests, parser.DefinitionLists)
}
func TestPreformattedHtml(t *testing.T) {
tests := readTestFile2(t, "PreformattedHtml.tests")
doTestsBlock(t, tests, 0)
}
func TestPreformattedHtmlLax(t *testing.T) {
tests := readTestFile2(t, "PreformattedHtmlLax.tests")
doTestsBlock(t, tests, parser.LaxHTMLBlocks)
}
func TestFencedCodeBlock(t *testing.T) {
tests := readTestFile2(t, "FencedCodeBlock.tests")
doTestsBlock(t, tests, parser.FencedCode)
}
func TestFencedCodeInsideBlockquotes(t *testing.T) {
tests := readTestFile2(t, "FencedCodeInsideBlockquotes.tests")
doTestsBlock(t, tests, parser.FencedCode)
}
func TestTable(t *testing.T) {
tests := readTestFile2(t, "Table.tests")
doTestsBlock(t, tests, parser.Tables)
}
func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
tests := readTestFile2(t, "UnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK.tests")
doTestsBlock(t, tests, parser.NoEmptyLineBeforeBlock)
}
func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
tests := readTestFile2(t, "OrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK.tests")
doTestsBlock(t, tests, parser.NoEmptyLineBeforeBlock)
}
func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
tests := readTestFile2(t, "FencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK.tests")
doTestsBlock(t, tests, parser.FencedCode|parser.NoEmptyLineBeforeBlock)
}
func TestMathBlock(t *testing.T) {
tests := readTestFile2(t, "MathBlock.tests")
doTestsBlock(t, tests, parser.CommonExtensions)
}
func TestDefinitionListWithFencedCodeBlock(t *testing.T) {
tests := readTestFile2(t, "DefinitionListWithFencedCodeBlock.tests")
doTestsBlock(t, tests, parser.FencedCode|parser.DefinitionLists)
}
func TestListWithFencedCodeBlockAndHeader(t *testing.T) {
tests := readTestFile2(t, "ListWithFencedCodeBlockAndHeader.tests")
doTestsBlock(t, tests, parser.FencedCode)
}
func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) {
tests := readTestFile2(t, "TitleBlock_EXTENSION_TITLEBLOCK.tests")
doTestsBlock(t, tests, parser.Titleblock)
}
func TestBlockComments(t *testing.T) {
tests := readTestFile2(t, "BlockComments.tests")
doTestsBlock(t, tests, 0)
}
func TestTOC(t *testing.T) {
tests := readTestFile2(t, "TOC.tests")
doTestsParam(t, tests, TestParams{
Flags: html.UseXHTML | html.TOC,
})
}
func TestCompletePage(t *testing.T) {
tests := readTestFile2(t, "CompletePage.tests")
doTestsParam(t, tests, TestParams{Flags: html.UseXHTML | html.CompletePage})
}
func TestSpaceHeadings(t *testing.T) {
tests := readTestFile2(t, "SpaceHeadings.tests")
doTestsParam(t, tests, TestParams{extensions: parser.SpaceHeadings})
}
func TestCodeInList(t *testing.T) {
tests := readTestFile2(t, "code_in_list.test")
exts := parser.CommonExtensions
doTestsParam(t, tests, TestParams{extensions: exts})
}
func TestLists(t *testing.T) {
tests := readTestFile2(t, "Lists.tests")
exts := parser.CommonExtensions
doTestsParam(t, tests, TestParams{extensions: exts})
}