diff options
author | Andrzej Ratajczak <32793002+BarkingBad@users.noreply.github.com> | 2022-01-12 15:04:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 17:04:59 +0300 |
commit | 6b729257b89ff5a19a52045efa386349feec0bc6 (patch) | |
tree | 790ca1fc300466496dc18e045997d4818b7a50e1 /runners/cli/src/test/kotlin | |
parent | b30db0aeafd5663dce3d3020f3dde6599ec368f3 (diff) | |
download | dokka-6b729257b89ff5a19a52045efa386349feec0bc6.tar.gz dokka-6b729257b89ff5a19a52045efa386349feec0bc6.tar.bz2 dokka-6b729257b89ff5a19a52045efa386349feec0bc6.zip |
Add global settings to JSON dokka cli input (#2292)
* Add global settings to JSON dokka cli input
* Apply requested changes
* Move initialization of global arguments to extension function in core module
Diffstat (limited to 'runners/cli/src/test/kotlin')
-rw-r--r-- | runners/cli/src/test/kotlin/cli/CliTest.kt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/runners/cli/src/test/kotlin/cli/CliTest.kt b/runners/cli/src/test/kotlin/cli/CliTest.kt new file mode 100644 index 00000000..5910e938 --- /dev/null +++ b/runners/cli/src/test/kotlin/cli/CliTest.kt @@ -0,0 +1,30 @@ +package org.jetbrains.dokka + +import junit.framework.Assert.assertTrue +import org.junit.Test +import java.lang.IllegalStateException +import java.nio.file.Paths +import kotlin.test.assertEquals + +class CliIntegrationTest { + + @Test + fun `should apply global settings to all source sets`() { + val jsonPath = Paths.get(javaClass.getResource("/my-file.json")?.toURI() ?: throw IllegalStateException("No JSON found!")).toFile().toString() + val globalArguments = GlobalArguments(arrayOf(jsonPath)) + + val configuration = initializeConfiguration(globalArguments) + + configuration.sourceSets.forEach { + assertTrue(it.perPackageOptions.isNotEmpty()) + assertTrue(it.sourceLinks.isNotEmpty()) + assertTrue(it.externalDocumentationLinks.isNotEmpty()) + + assertTrue(it.externalDocumentationLinks.any { it.url.toString() == "https://docs.oracle.com/javase/8/docs/api/" }) + assertEquals(it.sourceLinks.single().localDirectory, "/home/Vadim.Mishenev/dokka/examples/cli/src/main/kotlin") + assertEquals(it.perPackageOptions.single().matchingRegex, "my-custom-regex") + } + + } + +} |