aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/issues/IssuesTest.kt
blob: da5acd6e886b70007ea52d6f7a05785b20c84cb0 (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
package issues

import org.jetbrains.dokka.DocumentationNode
import org.jetbrains.dokka.NodeKind
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.tests.ModelConfig
import org.jetbrains.dokka.tests.checkSourceExistsAndVerifyModel
import org.junit.Test
import kotlin.test.assertEquals

abstract class BaseIssuesTest(val analysisPlatform: Platform) {
    val defaultModelConfig = ModelConfig(analysisPlatform = analysisPlatform)

    @Test
    fun errorClasses() {
        checkSourceExistsAndVerifyModel("testdata/issues/errorClasses.kt",
            modelConfig = ModelConfig(analysisPlatform = analysisPlatform, withJdk = true, withKotlinRuntime = true)) { model ->
            val cls = model.members.single().members.single()

            fun DocumentationNode.returnType() = this.details.find { it.kind == NodeKind.Type }?.name
            assertEquals("Test", cls.members[1].returnType())
            assertEquals("Test", cls.members[2].returnType())
            assertEquals("Test", cls.members[3].returnType())
            assertEquals("List", cls.members[4].returnType())
            assertEquals("String", cls.members[5].returnType())
            assertEquals("String", cls.members[6].returnType())
            assertEquals("String", cls.members[7].returnType())
        }
    }
}

class JSIssuesTest: BaseIssuesTest(Platform.js)
class JVMIssuesTest: BaseIssuesTest(Platform.jvm)
class CommonIssuesTest: BaseIssuesTest(Platform.common)