From 5f9299b074355e3f636da6eb6e1f9283f06ab8c7 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Thu, 21 May 2020 14:51:55 +0200 Subject: Return types links in inner classes with generic parents --- .../kotlin/linkableContent/LinkableContentTest.kt | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'plugins/base/src/test/kotlin/linkableContent') 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(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() + val foo = sample + .children.single { it.name == "SampleInner" }.cast() + .children.single { it.name == "foo" }.cast() + + val returnTypeNode = foo.content.dfs { + val link = it.safeAs()?.children + val child = link?.first().safeAs() + child?.text == "S" + }?.safeAs() + + Assertions.assertEquals(sample.dri.first(), returnTypeNode?.address) + } + } + } } \ No newline at end of file -- cgit