aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/model/LinkTest.kt
blob: c30e1c10e46dfeb953f607419190739a2c231401 (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
47
48
package org.jetbrains.dokka.tests

import org.junit.Test
import kotlin.test.*
import org.jetbrains.dokka.*

public class LinkTest {
    @Test fun linkToSelf() {
        verifyModel("testdata/links/linkToSelf.kt") { model ->
            with(model.members.single().members.single()) {
                assertEquals("Foo", name)
                assertEquals(DocumentationNode.Kind.Class, kind)
                assertEquals("This is link to [Foo -> Class:Foo]", content.summary.toTestString())
            }
        }
    }

    @Test fun linkToMember() {
        verifyModel("testdata/links/linkToMember.kt") { model ->
            with(model.members.single().members.single()) {
                assertEquals("Foo", name)
                assertEquals(DocumentationNode.Kind.Class, kind)
                assertEquals("This is link to [member -> Function:member]", content.summary.toTestString())
            }
        }
    }

    @Test fun linkToQualifiedMember() {
        verifyModel("testdata/links/linkToQualifiedMember.kt") { model ->
            with(model.members.single().members.single()) {
                assertEquals("Foo", name)
                assertEquals(DocumentationNode.Kind.Class, kind)
                assertEquals("This is link to [Foo.member -> Function:member]", content.summary.toTestString())
            }
        }
    }

    @Test fun linkToParam() {
        verifyModel("testdata/links/linkToParam.kt") { model ->
            with(model.members.single().members.single()) {
                assertEquals("Foo", name)
                assertEquals(DocumentationNode.Kind.Function, kind)
                assertEquals("This is link to [param -> Parameter:param]", content.summary.toTestString())
            }
        }
    }

}