aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/markdown/LinkTest.kt
blob: d38486b54964d1c08a022599c10a00b971e21cd9 (plain)
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
package markdown

import org.jetbrains.dokka.pages.ContentDRILink
import org.jetbrains.dokka.pages.MemberPageNode
import org.jetbrains.dokka.pages.dfs
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

class LinkTest : AbstractCoreTest() {
    @Test
    fun linkToClassLoader() {
        val configuration = dokkaConfiguration {
            passes {
                pass {
                    sourceRoots = listOf("src/main/kotlin/parser")
                }
            }
        }
        testInline(
            """
            |/src/main/kotlin/parser/Test.kt
            |package parser
            |
            | /**
            | * Some docs that link to [ClassLoader.clearAssertionStatus]
            | */
            |fun test(x: ClassLoader) = x.clearAssertionStatus()
            |
        """.trimMargin(),
            configuration
        ) {
            renderingStage = { rootPageNode, _ ->
                (rootPageNode.children.single().children.single() as MemberPageNode)
                    .content
                    .dfs { node -> node is ContentDRILink }
                    .let {
                        assertEquals(
                            "parser//test/#java.lang.ClassLoader//",
                            (it as ContentDRILink).address.toString()
                        )
                    }
            }
        }
    }
}