aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/linkableContent
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/linkableContent')
-rw-r--r--plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt43
1 files changed, 42 insertions, 1 deletions
diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
index c34fa909..33d3f64c 100644
--- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
+++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
@@ -11,7 +11,6 @@ import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.jetbrains.kotlin.utils.addToStdlib.cast
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.junit.jupiter.api.Assertions
-import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import java.nio.file.Paths
@@ -182,4 +181,46 @@ class LinkableContentTest : AbstractCoreTest() {
}
}
}
+
+ @Test
+ fun `Documenting return type for a function in inner class with generic parent`(){
+ testInline(
+ """
+ |/src/main/kotlin/test/source.kt
+ |package test
+ |
+ |class Sample<S>(first: S){
+ | inner class SampleInner {
+ | fun foo(): S = TODO()
+ | }
+ |}
+ |
+ """.trimIndent(),
+ dokkaConfiguration {
+ passes {
+ pass {
+ sourceRoots = listOf("src/")
+ analysisPlatform = "jvm"
+ targets = listOf("jvm")
+ }
+ }
+ }
+ ) {
+ renderingStage = { module, _ ->
+ val sample = module.children.single { it.name == "test" }
+ .children.single { it.name == "Sample" }.cast<ClasslikePageNode>()
+ val foo = sample
+ .children.single { it.name == "SampleInner" }.cast<ClasslikePageNode>()
+ .children.single { it.name == "foo" }.cast<MemberPageNode>()
+
+ val returnTypeNode = foo.content.dfs {
+ val link = it.safeAs<ContentDRILink>()?.children
+ val child = link?.first().safeAs<ContentText>()
+ child?.text == "S"
+ }?.safeAs<ContentDRILink>()
+
+ Assertions.assertEquals(sample.dri.first(), returnTypeNode?.address)
+ }
+ }
+ }
} \ No newline at end of file