blob: b0ec68ff972180801cce2a0e845f6e9dcf106588 [file] [log] [blame]
Tiem Songe1dd5122019-07-03 14:16:39 -07001package org.jetbrains.dokka.tests
2
3import org.junit.Test
4import org.jetbrains.dokka.toTestString
5import org.jetbrains.dokka.parseMarkdown
6import org.junit.Ignore
7
8@Ignore public class ParserTest {
9 fun runTestFor(text : String) {
10 println("MD: ---")
11 println(text)
12 val markdownTree = parseMarkdown(text)
13 println("AST: ---")
14 println(markdownTree.toTestString())
15 println()
16 }
17
18 @Test fun text() {
19 runTestFor("text")
20 }
21
22 @Test fun textWithSpaces() {
23 runTestFor("text and string")
24 }
25
26 @Test fun textWithColon() {
27 runTestFor("text and string: cool!")
28 }
29
30 @Test fun link() {
31 runTestFor("text [links]")
32 }
33
34 @Test fun linkWithHref() {
35 runTestFor("text [links](http://google.com)")
36 }
37
38 @Test fun multiline() {
39 runTestFor(
40 """
41text
42and
43string
44""")
45 }
46
47 @Test fun para() {
48 runTestFor(
49 """
50paragraph number
51one
52
53paragraph
54number two
55""")
56 }
57
58 @Test fun bulletList() {
59 runTestFor(
60 """* list item 1
61* list item 2
62""")
63 }
64
65 @Test fun bulletListWithLines() {
66 runTestFor(
67 """
68* list item 1
69 continue 1
70* list item 2
71 continue 2
72 """)
73 }
74
75 @Test fun bulletListStrong() {
76 runTestFor(
77 """
78* list *item* 1
79 continue 1
80* list *item* 2
81 continue 2
82 """)
83 }
84
85 @Test fun emph() {
86 runTestFor("*text*")
87 }
88
89 @Test fun underscoresNoEmph() {
90 runTestFor("text_with_underscores")
91 }
92
93 @Test fun emphUnderscores() {
94 runTestFor("_text_")
95 }
96
97 @Test fun singleStar() {
98 runTestFor("Embedded*Star")
99 }
100
101 @Test fun directive() {
102 runTestFor("A text \${code with.another.value} with directive")
103 }
104
105 @Test fun emphAndEmptySection() {
106 runTestFor("*text*\n\$sec:\n")
107 }
108
109 @Test fun emphAndSection() {
110 runTestFor("*text*\n\$sec: some text\n")
111 }
112
113 @Test fun emphAndBracedSection() {
114 runTestFor("Text *bold* text \n\${sec}: some text")
115 }
116
117 @Test fun section() {
118 runTestFor(
119 "Plain text \n\$one: Summary \n\${two}: Description with *emphasis* \n\${An example of a section}: Example")
120 }
121
122 @Test fun anonymousSection() {
123 runTestFor("Summary\n\nDescription\n")
124 }
125
126 @Test fun specialSection() {
127 runTestFor(
128 "Plain text \n\$\$summary: Summary \n\${\$description}: Description \n\${\$An example of a section}: Example")
129 }
130
131 @Test fun emptySection() {
132 runTestFor(
133 "Plain text \n\$summary:")
134 }
135
136 val b = "$"
137 @Test fun pair() {
138 runTestFor(
139 """Represents a generic pair of two values.
140
141There is no meaning attached to values in this class, it can be used for any purpose.
142Pair exhibits value semantics, i.e. two pairs are equal if both components are equal.
143
144An example of decomposing it into values:
145${b}{code test.tuples.PairTest.pairMultiAssignment}
146
147${b}constructor: Creates new instance of [Pair]
148${b}first: First value
149${b}second: Second value""""
150 )
151 }
152
153}
154