From cb20227d354b1b74ca6784d55ea75cc8b5281abd Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 7 Jul 2020 11:08:34 +0200 Subject: Implement simple cli integration test --- .../jetbrains/dokka/it/AbstractIntegrationTest.kt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt (limited to 'integration-tests/src') 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 new file mode 100644 index 00000000..4af523a2 --- /dev/null +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt @@ -0,0 +1,39 @@ +package org.jetbrains.dokka.it + +import org.junit.Rule +import org.junit.rules.TemporaryFolder +import java.io.File +import kotlin.test.assertFalse + +abstract class AbstractIntegrationTest { + + @get:Rule + val temporaryTestFolder = TemporaryFolder() + + val projectDir get() = File(temporaryTestFolder.root, "project") + + fun File.allDescendentsWithExtension(extension: String): Sequence { + return this.walkTopDown().filter { it.isFile && it.extension == extension } + } + + fun File.allHtmlFiles(): Sequence { + return allDescendentsWithExtension("html") + } + + protected fun assertContainsNoErrorClass(file: File) { + val fileText = file.readText() + assertFalse( + fileText.contains("ERROR CLASS", ignoreCase = true), + "Unexpected `ERROR CLASS` in ${file.path}\n" + fileText + ) + } + + protected fun assertNoUnresolvedLInks(file: File) { + val regex = Regex("[\"']#[\"']") + val fileText = file.readText() + assertFalse( + fileText.contains(regex), + "Unexpected unresolved link in ${file.path}\n" + fileText + ) + } +} -- cgit