From ac5e13ae3e3935ce21984ce572edae4bfd695e63 Mon Sep 17 00:00:00 2001 From: "Vadim.Mishenev" Date: Thu, 19 Oct 2023 01:19:34 +0300 Subject: [PATCH] Fix tests --- .../content/annotations/SinceKotlinTest.kt | 90 +++++++++++++++---- .../linkableContent/LinkableContentTest.kt | 4 +- 2 files changed, 74 insertions(+), 20 deletions(-) diff --git a/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt b/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt index 4cb2570441..414ff500e6 100644 --- a/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt @@ -14,10 +14,7 @@ import org.jetbrains.dokka.model.doc.CustomTagWrapper import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.pages.ContentPage import signatures.AbstractRenderingTest -import utils.ParamAttributes -import utils.TestOutputWriterPlugin -import utils.assertNotNull -import utils.bareSignature +import utils.* import kotlin.test.* @@ -125,30 +122,54 @@ class SinceKotlinTest : AbstractRenderingTest() { val configuration = dokkaConfiguration { sourceSets { sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/jvm/") analysisPlatform = "jvm" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/native/") analysisPlatform = "native" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/common/") analysisPlatform = "common" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/js/") analysisPlatform = "js" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/wasm/") analysisPlatform = "wasm" } } } testInline( """ - |/src/main/kotlin/test/source.kt + |/src/jvm/kotlin/test/source.kt + |package test + | + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/native/kotlin/test/source.kt + |package test + | + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/common/kotlin/test/source.kt + |package test + | + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/js/kotlin/test/source.kt + |package test + | + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/wasm/kotlin/test/source.kt |package test | |fun ring(abc: String): String { @@ -181,37 +202,70 @@ class SinceKotlinTest : AbstractRenderingTest() { } @Test + @OnlyDescriptorsMPP("SinceKotlin is unresolved in platform source sets") fun `mpp fun with SinceKotlin annotation`() { val configuration = dokkaConfiguration { sourceSets { sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/jvm/") classpath = listOfNotNull(jvmStdlibPath) analysisPlatform = "jvm" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/native/") analysisPlatform = "native" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/common/") classpath = listOfNotNull(commonStdlibPath) analysisPlatform = "common" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/js/") classpath = listOfNotNull(jsStdlibPath) analysisPlatform = "js" } sourceSet { - sourceRoots = listOf("src/") + sourceRoots = listOf("src/wasm/") analysisPlatform = "wasm" } } } testInline( """ - |/src/main/kotlin/test/source.kt + |/src/jvm/kotlin/test/source.kt + |package test + | + |/** dssdd */ + |@SinceKotlin("1.3") + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/native/kotlin/test/source.kt + |package test + | + |/** dssdd */ + |@SinceKotlin("1.3") + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/common/kotlin/test/source.kt + |package test + | + |/** dssdd */ + |@SinceKotlin("1.3") + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/js/kotlin/test/source.kt + |package test + | + |/** dssdd */ + |@SinceKotlin("1.3") + |fun ring(abc: String): String { + | return "My precious " + abc + |} + |/src/wasm/kotlin/test/source.kt |package test | |/** dssdd */ @@ -226,7 +280,7 @@ class SinceKotlinTest : AbstractRenderingTest() { .children.filter { it.name == "ring" && it is DFunction } as List with(funcs) { val sinceKotlin = mapOf( - Platform.common to SinceKotlinVersion("1.3"), + // Platform.common to SinceKotlinVersion("1.3"), Platform.jvm to SinceKotlinVersion("1.3"), Platform.js to SinceKotlinVersion("1.3"), Platform.native to SinceKotlinVersion("1.3"), @@ -238,7 +292,7 @@ class SinceKotlinTest : AbstractRenderingTest() { find { it.sourceSets.first().analysisPlatform == i.key }?.documentation?.values?.first() ?.dfs { it is CustomTagWrapper && it.name == "Since Kotlin" } .assertNotNull("SinceKotlin[${i.key}]") - assertEquals((tag.children.first() as Text).body, i.value.toString()) + assertEquals(i.value.toString(), (tag.children.first() as Text).body , "Platform ${i.key}") } } } diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index 504a1ebe5e..bff0ae6ccd 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -286,7 +286,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceSets { sourceSet { analysisPlatform = "js" - sourceRoots = listOf("jsMain", "commonMain", "jvmAndJsSecondCommonMain").map { + sourceRoots = listOf("jsMain").map { Paths.get("$testDataDir/$it/kotlin").toString() } name = "js" @@ -294,7 +294,7 @@ class LinkableContentTest : BaseAbstractTest() { } sourceSet { analysisPlatform = "jvm" - sourceRoots = listOf("jvmMain", "commonMain", "jvmAndJsSecondCommonMain").map { + sourceRoots = listOf("jvmMain").map { Paths.get("$testDataDir/$it/kotlin").toString() } name = "jvm"