aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src/test/kotlin/org
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-09-08 12:10:59 +0200
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-10-08 17:24:29 +0200
commitbe3fea152ae5dcec5ba9a29d86a69010d6b2e428 (patch)
tree35d657281f66fceeff6ee66bbb1aa85ff830262b /plugins/javadoc/src/test/kotlin/org
parent68553bf4c1de2b640a376f0ac4755a6c5bc7dd79 (diff)
downloaddokka-be3fea152ae5dcec5ba9a29d86a69010d6b2e428.tar.gz
dokka-be3fea152ae5dcec5ba9a29d86a69010d6b2e428.tar.bz2
dokka-be3fea152ae5dcec5ba9a29d86a69010d6b2e428.zip
Adding configuration mpp check for javadoc
Diffstat (limited to 'plugins/javadoc/src/test/kotlin/org')
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt80
1 files changed, 80 insertions, 0 deletions
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt
new file mode 100644
index 00000000..9d70f444
--- /dev/null
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/validity/MultiplatformConfiguredCheckerTest.kt
@@ -0,0 +1,80 @@
+package org.jetbrains.dokka.javadoc.validity
+
+import org.jetbrains.dokka.DokkaConfigurationImpl
+import org.jetbrains.dokka.DokkaException
+import org.jetbrains.dokka.ExternalDocumentationLink
+import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.junit.jupiter.api.Test
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
+
+class MultiplatformConfiguredCheckerTest : AbstractCoreTest() {
+
+ val mppConfig: DokkaConfigurationImpl = dokkaConfiguration {
+ format = "javadoc"
+ sourceSets {
+ sourceSet {
+ sourceRoots = listOf("src")
+ analysisPlatform = "jvm"
+ externalDocumentationLinks = listOf(
+ ExternalDocumentationLink("https://docs.oracle.com/javase/8/docs/api/"),
+ ExternalDocumentationLink("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ )
+ }
+ sourceSet {
+ sourceRoots = listOf("src")
+ analysisPlatform = "js"
+ externalDocumentationLinks = listOf(
+ ExternalDocumentationLink("https://docs.oracle.com/javase/8/docs/api/"),
+ ExternalDocumentationLink("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ )
+ }
+ }
+ }
+
+ val sppConfig: DokkaConfigurationImpl = dokkaConfiguration {
+ format = "javadoc"
+ sourceSets {
+ sourceSet {
+ sourceRoots = listOf("src")
+ analysisPlatform = "jvm"
+ externalDocumentationLinks = listOf(
+ ExternalDocumentationLink("https://docs.oracle.com/javase/8/docs/api/"),
+ ExternalDocumentationLink("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `mpp config should fail for javadoc`() {
+ testInline("", mppConfig) {
+ verificationStage = { verification ->
+ var mppDetected = false
+ try {
+ verification()
+ } catch (e: DokkaException) {
+ mppDetected =
+ e.localizedMessage == "Pre-generation validity check failed: ${MultiplatformConfiguredChecker.errorMessage}"
+ }
+ assertTrue(mppDetected, "MPP configuration not detected")
+ }
+ }
+ }
+
+ @Test
+ fun `spp config should not fail for javadoc`() {
+ testInline("", sppConfig) {
+ verificationStage = { verification ->
+ var mppDetected = false
+ try {
+ verification()
+ } catch (e: DokkaException) {
+ mppDetected =
+ e.localizedMessage == "Pre-generation validity check failed: ${MultiplatformConfiguredChecker.errorMessage}"
+ }
+ assertFalse(mppDetected, "SPP taken as multiplatform")
+ }
+ }
+ }
+} \ No newline at end of file