diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-07-03 16:18:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-03 16:18:43 +0300 |
commit | cbd9733d3dd2f52992e98e7cebd072091a572529 (patch) | |
tree | d7142fb1c8b83b9f4c2d8abb873f8847c427a0d5 /plugins/base/src/test/kotlin/signatures/SignatureTest.kt | |
parent | 12a386bb7185f862a1cbd831e6856c4235953833 (diff) | |
download | dokka-cbd9733d3dd2f52992e98e7cebd072091a572529.tar.gz dokka-cbd9733d3dd2f52992e98e7cebd072091a572529.tar.bz2 dokka-cbd9733d3dd2f52992e98e7cebd072091a572529.zip |
Enhance typealias presentation (#3053)
Diffstat (limited to 'plugins/base/src/test/kotlin/signatures/SignatureTest.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/signatures/SignatureTest.kt | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index d271be2e..38ae2be3 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -8,7 +8,6 @@ import org.jetbrains.dokka.model.dfs import org.junit.jupiter.api.Test import utils.* import kotlin.test.assertEquals - class SignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { sourceSets { @@ -36,7 +35,8 @@ class SignatureTest : BaseAbstractTest() { name = "jvm" dependentSourceSets = setOf(DokkaSourceSetID("test", "common")) sourceRoots = listOf("src/main/kotlin/jvm/Test.kt") - classpath = listOf(commonStdlibPath!!) + classpath = listOf( + commonStdlibPath ?: throw IllegalStateException("Common stdlib is not found"),) externalDocumentationLinks = listOf(stdlibExternalDocumentationLink) } } @@ -549,6 +549,39 @@ class SignatureTest : BaseAbstractTest() { } } } + @Test + fun `actual typealias should have generic parameters and fully qualified name of the expansion type`() { + val writerPlugin = TestOutputWriterPlugin() + + testInline( + """ + |/src/main/kotlin/common/Test.kt + |package example + | + |expect class Array<T> + | + |/src/main/kotlin/jvm/Test.kt + |package example + | + |actual typealias Array<T> = kotlin.Array<T> + """.trimMargin(), + mppConfiguration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + val signatures = writerPlugin.writer.renderedContent("test/example/-array/index.html").signature().toList() + + signatures[0].match( + "expect class ", A("Array"), "<", A("T"), ">", + ignoreSpanWithTokenStyle = true + ) + signatures[1].match( + "actual typealias ", A("Array"), "<", A("T"), "> = ", A("kotlin.Array"), "<", A("T"), ">", + ignoreSpanWithTokenStyle = true + ) + } + } + } @Test fun `type with an actual typealias`() { |