aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-05-21 14:51:55 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-28 12:11:47 +0200
commit5f9299b074355e3f636da6eb6e1f9283f06ab8c7 (patch)
tree3ceb70a5dc2640f10e198535b1390c6aca14d223 /plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
parentdd5d4ba7d80b0880489cf74bb11549ff836fc41f (diff)
downloaddokka-5f9299b074355e3f636da6eb6e1f9283f06ab8c7.tar.gz
dokka-5f9299b074355e3f636da6eb6e1f9283f06ab8c7.tar.bz2
dokka-5f9299b074355e3f636da6eb6e1f9283f06ab8c7.zip
Return types links in inner classes with generic parents
Diffstat (limited to 'plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt')
-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