diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-08-30 15:58:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 15:58:46 +0200 |
commit | c63ea36637ce956029fb15b1482c0683ecb8a587 (patch) | |
tree | 2b75a8a976b43530820e73dc60cce4b10d9fc005 /plugins/base/src/test/kotlin/signatures | |
parent | 0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff) | |
download | dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2 dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip |
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'plugins/base/src/test/kotlin/signatures')
6 files changed, 38 insertions, 26 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt index af10cbee..e276ee5c 100644 --- a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt @@ -1,9 +1,10 @@ package signatures -import org.junit.jupiter.api.Test +import utils.TestOutputWriterPlugin +import kotlin.test.Test +import kotlin.test.assertEquals import utils.OnlyDescriptors import utils.OnlyDescriptorsMPP -import utils.TestOutputWriterPlugin @OnlyDescriptorsMPP class DivergentSignatureTest : AbstractRenderingTest() { @@ -20,10 +21,10 @@ class DivergentSignatureTest : AbstractRenderingTest() { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-clock/get-time.html") - assert(content.count() == 3) + assertEquals(3, content.count()) val sourceSets = listOf("example/common", "example/js", "example/jvm") sourceSets.forEach { - assert(content.select("[data-togglable=$it]").single().brief == "") + assertEquals("", content.select("[data-togglable=$it]").single().brief) } } } @@ -41,10 +42,10 @@ class DivergentSignatureTest : AbstractRenderingTest() { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-clock/get-times-in-millis.html") - assert(content.count() == 3) - assert(content.select("[data-togglable=example/common]").single().brief == "Time in minis") - assert(content.select("[data-togglable=example/jvm]").single().brief == "Time in minis") - assert(content.select("[data-togglable=example/js]").single().brief == "JS implementation of getTimeInMillis" ) + assertEquals(3, content.count()) + assertEquals("Time in minis", content.select("[data-togglable=example/common]").single().brief) + assertEquals("Time in minis", content.select("[data-togglable=example/jvm]").single().brief) + assertEquals("JS implementation of getTimeInMillis", content.select("[data-togglable=example/js]").single().brief) } } } @@ -60,10 +61,10 @@ class DivergentSignatureTest : AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-clock/get-year.html") - assert(content.count() == 3) - assert(content.select("[data-togglable=example/jvm]").single().brief == "JVM custom kdoc") - assert(content.select("[data-togglable=example/js]").single().brief == "JS custom kdoc") - assert(content.select("[data-togglable=example/common]").single().brief == "") + assertEquals(3, content.count()) + assertEquals("JVM custom kdoc", content.select("[data-togglable=example/jvm]").single().brief) + assertEquals("JS custom kdoc", content.select("[data-togglable=example/js]").single().brief) + assertEquals("", content.select("[data-togglable=example/common]").single().brief) } } } diff --git a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt index 588b3d50..8a4a8fd5 100644 --- a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt @@ -3,9 +3,13 @@ package signatures import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.jdk -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import utils.* +import utils.A +import utils.Span +import utils.TestOutputWriterPlugin +import utils.match +import utils.JavaCode +import kotlin.test.Ignore +import kotlin.test.Test class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { @@ -143,7 +147,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() { } } } - @Disabled // Add coroutines on classpath and get proper import + @Ignore // Add coroutines on classpath and get proper import @Test fun `kotlin normal suspendable function`() { val source = source("val nF: SuspendFunction1<Int, String> = { _ -> \"\" }") diff --git a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt index 4cd9a94d..d4600012 100644 --- a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt @@ -2,8 +2,13 @@ package signatures import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test -import utils.* +import utils.A +import utils.Span +import utils.TestOutputWriterPlugin +import utils.match +import utils.JavaCode +import utils.OnlyDescriptors +import kotlin.test.Test import kotlin.test.assertEquals @JavaCode diff --git a/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt b/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt index 38c70cd4..87763e48 100644 --- a/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt +++ b/plugins/base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt @@ -1,8 +1,8 @@ package signatures import org.jsoup.Jsoup -import org.junit.jupiter.api.Test import utils.TestOutputWriterPlugin +import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -17,7 +17,7 @@ class RawHtmlRenderingTest: AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-html-test/test.html") - assert(content.count() == 1) + assertEquals(1, content.count()) assertEquals(content.select("[data-togglable=example/jvm]").single().rawBrief,"This is an example <!-- not visible --> of html") val indexContent = writerPlugin.writer.contents.getValue("example/example/-html-test/index.html") @@ -54,7 +54,7 @@ class RawHtmlRenderingTest: AbstractRenderingTest() { ) { renderingStage = { _, _ -> val content = writerPlugin.renderedSourceDependentContent("example/example/-html-test/test-p.html") - assert(content.count() == 1) + assertEquals(1, content.count()) assertEquals(content.select("[data-togglable=example/jvm]").single().rawBrief, "This is an <b> documentation </b>") val indexContent = writerPlugin.writer.contents.getValue("example/example/-html-test/index.html") @@ -63,4 +63,4 @@ class RawHtmlRenderingTest: AbstractRenderingTest() { } } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index 00d98102..3a73153a 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -5,9 +5,11 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DFunction import org.jetbrains.dokka.model.DefinitelyNonNullable import org.jetbrains.dokka.model.dfs -import org.junit.jupiter.api.Test import utils.* +import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue + class SignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { sourceSets { @@ -204,8 +206,8 @@ class SignatureTest : BaseAbstractTest() { documentablesTransformationStage = { val fn = (it.dfs { it.name == "elvisLike" } as? DFunction).assertNotNull("Function elvisLike") - assert(fn.type is DefinitelyNonNullable) - assert(fn.parameters[1].type is DefinitelyNonNullable) + assertTrue(fn.type is DefinitelyNonNullable) + assertTrue(fn.parameters[1].type is DefinitelyNonNullable) } renderingStage = { _, _ -> val signature = writerPlugin.writer.renderedContent("root/example/elvis-like.html") diff --git a/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt index 06a3daae..f8ad218c 100644 --- a/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt @@ -1,10 +1,10 @@ package signatures import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.junit.jupiter.api.Test import utils.A import utils.TestOutputWriterPlugin import utils.match +import kotlin.test.Test class VarianceSignatureTest : BaseAbstractTest() { private val configuration = dokkaConfiguration { |