diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-02-24 16:17:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 16:17:45 +0100 |
commit | cbbc62ff5e1c406037ba5a6e5c9b81f3b53d2700 (patch) | |
tree | 37cf26f8b257c7b6e5b3d0178778e19330e061f1 /integration-tests/cli/src/integrationTest/kotlin | |
parent | e07f411dc3c2e99acf18dfa428546804b80d30f9 (diff) | |
download | dokka-cbbc62ff5e1c406037ba5a6e5c9b81f3b53d2700.tar.gz dokka-cbbc62ff5e1c406037ba5a6e5c9b81f3b53d2700.tar.bz2 dokka-cbbc62ff5e1c406037ba5a6e5c9b81f3b53d2700.zip |
Fix parameters on cli and bump kotlinx.cli (#1755)
Diffstat (limited to 'integration-tests/cli/src/integrationTest/kotlin')
-rw-r--r-- | integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt index aabc30c1..8fdcaad5 100644 --- a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt +++ b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt @@ -2,10 +2,7 @@ package org.jetbrains.dokka.it.cli import org.jetbrains.dokka.it.awaitProcessResult import java.io.File -import kotlin.test.BeforeTest -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertTrue +import kotlin.test.* class CliIntegrationTest : AbstractCliIntegrationTest() { @@ -86,5 +83,68 @@ class CliIntegrationTest : AbstractCliIntegrationTest() { assertNoEmptyLinks(file) assertNoEmptySpans(file) } + + assertFalse( + projectDir.resolve("output").resolve("index.html").readText().contains("emptypackagetest"), + "Expected not to render empty packages" + ) + } + + @Test + fun failCli() { + val dokkaOutputDir = File(projectDir, "output") + assertTrue(dokkaOutputDir.mkdirs()) + val process = ProcessBuilder( + "java", "-jar", cliJarFile.path, + "-outputDir", dokkaOutputDir.path, + "-pluginsClasspath", basePluginJarFile.path, + "-moduleName", "Basic Project", + "-failOnWarning", + "-sourceSet", + buildString { + append(" -sourceSetName cliMain") + append(" -src ${File(projectDir, "src").path}") + append(" -jdkVersion 8") + append(" -analysisPlatform jvm") + append(" -reportUndocumented") + } + ) + .redirectErrorStream(true) + .start() + + val result = process.awaitProcessResult() + assertEquals(1, result.exitCode, "Expected exitCode 1 (Fail)") + + assertTrue(result.output.contains("Exception in thread \"main\" org.jetbrains.dokka.DokkaException: Failed with warningCount")) + } + + @Test + fun emptyPackagesTest() { + val dokkaOutputDir = File(projectDir, "output") + assertTrue(dokkaOutputDir.mkdirs()) + val process = ProcessBuilder( + "java", "-jar", cliJarFile.path, + "-outputDir", dokkaOutputDir.path, + "-pluginsClasspath", basePluginJarFile.path, + "-moduleName", "Basic Project", + "-sourceSet", + buildString { + append(" -sourceSetName cliMain") + append(" -src ${File(projectDir, "src").path}") + append(" -jdkVersion 8") + append(" -analysisPlatform jvm") + append(" -noSkipEmptyPackages") + } + ) + .redirectErrorStream(true) + .start() + + val result = process.awaitProcessResult() + assertEquals(0, result.exitCode, "Expected exitCode 0 (Success)") + + assertTrue( + projectDir.resolve("output").resolve("index.html").readText().contains("emptypackagetest"), + "Expected to render empty packages" + ) } } |