/
CodeWrappingTest.kt
48 lines (43 loc) · 1.44 KB
/
CodeWrappingTest.kt
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
package renderers.gfm
import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import renderers.*
class CodeWrappingTest : GfmRenderingOnlyTestBase() {
@Test
fun wrappedCodeBlock() {
val page = testPage {
codeBlock {
text("fun myCode(): String")
}
}
val expect = """|//[testPage](test-page.md)
|
|```kotlin
|fun myCode(): String
|```""".trimMargin()
CommonmarkRenderer(context).render(page)
assertEquals(expect, renderedContent)
}
@Test
fun wrappedInlineCode() {
val page = testPage {
text("This function adds the values of ")
codeInline("") {
text("left")
}
text(" and ")
codeInline("") {
text("right")
}
text(".\nBoth numbers must be finite, or an exception occurs.\n")
}
val expect = """|//[testPage](test-page.md)
|
|This function adds the values of `left` and `right`.
|Both numbers must be finite, or an exception occurs.""".trimMargin()
CommonmarkRenderer(context).render(page)
assertEquals(expect, renderedContent)
}
}