From cbd9733d3dd2f52992e98e7cebd072091a572529 Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Mon, 3 Jul 2023 16:18:43 +0300 Subject: Enhance typealias presentation (#3053) --- .../src/test/kotlin/signatures/SignatureTest.kt | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'plugins/base/src/test/kotlin/signatures/SignatureTest.kt') 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 + | + |/src/main/kotlin/jvm/Test.kt + |package example + | + |actual typealias Array = kotlin.Array + """.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`() { -- cgit