diff options
Diffstat (limited to 'integration-tests')
11 files changed, 46 insertions, 43 deletions
diff --git a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt b/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt index bf83ab07..c7c77e68 100644 --- a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt +++ b/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt @@ -9,7 +9,7 @@ import java.io.File import kotlin.test.BeforeTest import kotlin.test.assertTrue -abstract class AbstractCliIntegrationTest : AbstractIntegrationTest() { +public abstract class AbstractCliIntegrationTest : AbstractIntegrationTest() { protected val cliJarFile: File by lazy { File(tempFolder, "dokka.jar") @@ -20,7 +20,7 @@ abstract class AbstractCliIntegrationTest : AbstractIntegrationTest() { } @BeforeTest - fun copyJarFiles() { + public fun copyJarFiles() { val cliJarPathEnvironmentKey = "CLI_JAR_PATH" val cliJarFile = File(System.getenv(cliJarPathEnvironmentKey)) assertTrue( diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt index 0e8fd59a..7d6b42c3 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt @@ -6,7 +6,6 @@ package org.jetbrains.dokka.it.gradle import org.gradle.util.GradleVersion import java.io.File -import kotlin.test.assertContains import kotlin.test.assertTrue abstract class AbstractGradleCachingIntegrationTest : AbstractGradleIntegrationTest() { @@ -128,12 +127,13 @@ abstract class AbstractGradleCachingIntegrationTest : AbstractGradleIntegrationT "Anchors should not have hashes inside" ) - assertContains( - stylesDir.resolve("logo-styles.css").readText(), - "--dokka-logo-image-url: url('https://upload.wikimedia.org/wikipedia/commons/9/9d/Ubuntu_logo.svg');", + assertTrue( + stylesDir.resolve("logo-styles.css").readText().contains( + "--dokka-logo-image-url: url('https://upload.wikimedia.org/wikipedia/commons/9/9d/Ubuntu_logo.svg');", + ) ) assertTrue(stylesDir.resolve("custom-style-to-add.css").isFile) - assertContains(stylesDir.resolve("custom-style-to-add.css").readText(), "/* custom stylesheet */") + assertTrue(stylesDir.resolve("custom-style-to-add.css").readText().contains("/* custom stylesheet */")) allHtmlFiles().forEach { file -> if(file.name != "navigation.html") assertTrue("custom-style-to-add.css" in file.readText(), "custom styles not added to html file ${file.name}") } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt index 1c067a8b..0256f593 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt @@ -134,12 +134,13 @@ class BasicGradleIntegrationTest : AbstractGradleIntegrationTest() { "Anchors should not have hashes inside" ) - assertContains( - stylesDir.resolve("logo-styles.css").readText(), - "--dokka-logo-image-url: url('https://upload.wikimedia.org/wikipedia/commons/9/9d/Ubuntu_logo.svg');", + assertTrue( + stylesDir.resolve("logo-styles.css").readText().contains( + "--dokka-logo-image-url: url('https://upload.wikimedia.org/wikipedia/commons/9/9d/Ubuntu_logo.svg');", + ) ) assertTrue(stylesDir.resolve("custom-style-to-add.css").isFile) - assertContains(stylesDir.resolve("custom-style-to-add.css").readText(), "/* custom stylesheet */") + assertTrue(stylesDir.resolve("custom-style-to-add.css").readText().contains("/* custom stylesheet */")) allHtmlFiles().forEach { file -> if (file.name != "navigation.html") assertTrue( "custom-style-to-add.css" in file.readText(), diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 490619e0..f2b28578 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -14,17 +14,17 @@ import java.io.File import java.net.URI import kotlin.test.BeforeTest -abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { +public abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { @BeforeTest - fun copyTemplates() { + public fun copyTemplates() { File("projects").listFiles().orEmpty() .filter { it.isFile } .filter { it.name.startsWith("template.") } .forEach { file -> file.copyTo(File(tempFolder, file.name)) } } - fun createGradleRunner( + public fun createGradleRunner( buildVersions: BuildVersions, vararg arguments: String, jvmArgs: List<String> = listOf("-Xmx2G", "-XX:MaxMetaspaceSize=1G") @@ -47,7 +47,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { .withJvmArguments(jvmArgs) } - fun GradleRunner.buildRelaxed(): BuildResult { + public fun GradleRunner.buildRelaxed(): BuildResult { return try { build() } catch (e: Throwable) { diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt index 6cd73e32..ab387420 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt @@ -6,12 +6,12 @@ package org.jetbrains.dokka.it.gradle import org.gradle.util.GradleVersion -data class BuildVersions( +public data class BuildVersions( val gradleVersion: GradleVersion, val kotlinVersion: String, val androidGradlePluginVersion: String? = null, ) { - constructor( + public constructor( gradleVersion: String, kotlinVersion: String, androidGradlePluginVersion: String? = null @@ -30,8 +30,8 @@ data class BuildVersions( } } - companion object { - fun permutations( + public companion object { + public fun permutations( gradleVersions: List<String>, kotlinVersions: List<String>, androidGradlePluginVersions: List<String?> = listOf(null) diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt index 206c03dd..174060aa 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt @@ -4,8 +4,8 @@ package org.jetbrains.dokka.it.gradle -object TestEnvironment { - val isExhaustive = checkNotNull(System.getenv("isExhaustive")) { +public object TestEnvironment { + public val isExhaustive: Boolean = checkNotNull(System.getenv("isExhaustive")) { "Missing `isExhaustive` environment variable" }.toBoolean() } @@ -13,6 +13,6 @@ object TestEnvironment { /** * Will only return values if [TestEnvironment.isExhaustive] is set to true */ -inline fun <reified T> ifExhaustive(vararg values: T): Array<out T> { +public inline fun <reified T> ifExhaustive(vararg values: T): Array<out T> { return if (TestEnvironment.isExhaustive) values else emptyArray() } diff --git a/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt index 577e75a2..92bdc45e 100644 --- a/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt +++ b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt @@ -60,15 +60,16 @@ class MavenIntegrationTest : AbstractIntegrationTest() { assertNoEmptySpans(file) } - assertContains( - stylesDir.resolve("logo-styles.css").readText(), - "--dokka-logo-image-url: url('https://upload.wikimedia.org/wikipedia/commons/9/9d/Ubuntu_logo.svg');", + assertTrue( + stylesDir.resolve("logo-styles.css").readText().contains( + "--dokka-logo-image-url: url('https://upload.wikimedia.org/wikipedia/commons/9/9d/Ubuntu_logo.svg');", + ) ) assertTrue(stylesDir.resolve("custom-style-to-add.css").isFile) projectDir.allHtmlFiles().forEach { file -> if(file.name != "navigation.html") assertTrue("custom-style-to-add.css" in file.readText(), "custom styles not added to html file ${file.name}") } - assertContains(stylesDir.resolve("custom-style-to-add.css").readText(), """/* custom stylesheet */""") + assertTrue(stylesDir.resolve("custom-style-to-add.css").readText().contains("""/* custom stylesheet */""")) assertTrue(imagesDir.resolve("custom-resource.svg").isFile) assertConfiguredVisibility(projectDir) diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt index 6a20ca20..ec96ac01 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt @@ -13,19 +13,19 @@ import kotlin.test.assertFalse import kotlin.test.assertNotNull import kotlin.test.assertTrue -abstract class AbstractIntegrationTest { +public abstract class AbstractIntegrationTest { @field:TempDir - lateinit var tempFolder: File + public lateinit var tempFolder: File - val projectDir get() = File(tempFolder, "project") + public val projectDir: File get() = File(tempFolder, "project") - fun File.allDescendentsWithExtension(extension: String): Sequence<File> = + public fun File.allDescendentsWithExtension(extension: String): Sequence<File> = this.walkTopDown().filter { it.isFile && it.extension == extension } - fun File.allHtmlFiles(): Sequence<File> = allDescendentsWithExtension("html") + public fun File.allHtmlFiles(): Sequence<File> = allDescendentsWithExtension("html") - fun File.allGfmFiles(): Sequence<File> = allDescendentsWithExtension("md") + public fun File.allGfmFiles(): Sequence<File> = allDescendentsWithExtension("md") protected fun assertContainsNoErrorClass(file: File) { val fileText = file.readText() diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt index 87bd3e94..681c9d53 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt @@ -7,11 +7,11 @@ package org.jetbrains.dokka.it import java.io.File import kotlin.test.AfterTest -interface TestOutputCopier { - val projectOutputLocation: File +public interface TestOutputCopier { + public val projectOutputLocation: File @AfterTest - fun copyToLocation() { + public fun copyToLocation() { System.getenv("DOKKA_TEST_OUTPUT_PATH")?.also { location -> println("Copying to ${File(location).absolutePath}") projectOutputLocation.copyRecursively(File(location)) diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt index dbacde83..b4c63330 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt @@ -9,13 +9,14 @@ import org.eclipse.jgit.storage.file.FileRepositoryBuilder import java.io.File import java.nio.file.Path -fun AbstractIntegrationTest.copyAndApplyGitDiff(diffFile: File) = +public fun AbstractIntegrationTest.copyAndApplyGitDiff(diffFile: File) { copyGitDiffFileToParent(diffFile).let(::applyGitDiffFromFile) +} -fun AbstractIntegrationTest.copyGitDiffFileToParent(originalDiffFile: File) = +public fun AbstractIntegrationTest.copyGitDiffFileToParent(originalDiffFile: File): File = originalDiffFile.copyTo(File(projectDir.parent, originalDiffFile.name)) -fun AbstractIntegrationTest.applyGitDiffFromFile(diffFile: File) { +public fun AbstractIntegrationTest.applyGitDiffFromFile(diffFile: File) { val projectGitFile = projectDir.resolve(".git") val git = if (projectGitFile.exists()) { if (projectGitFile.isFile) { @@ -38,7 +39,7 @@ fun AbstractIntegrationTest.applyGitDiffFromFile(diffFile: File) { private fun removeGitFile(repository: Path) = repository.toFile() .listFiles().orEmpty() - .filter { it.name.lowercase() == ".git" } + .filter { it.name.toLowerCase() == ".git" } .forEach { it.delete() } diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt index c72856b5..06b8b1e3 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt @@ -9,12 +9,12 @@ import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking import kotlin.concurrent.thread -class ProcessResult( - val exitCode: Int, - val output: String +public class ProcessResult( + public val exitCode: Int, + public val output: String ) -fun Process.awaitProcessResult() = runBlocking { +public fun Process.awaitProcessResult(): ProcessResult = runBlocking { val exitCode = async { awaitExitCode() } val output = async { awaitOutput() } ProcessResult( |