aboutsummaryrefslogtreecommitdiff
path: root/integration-tests/src
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-07 11:08:34 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-07 13:31:38 +0200
commitcb20227d354b1b74ca6784d55ea75cc8b5281abd (patch)
tree2284ff9b5535a735655a9ad0ee436f2aa4e68a07 /integration-tests/src
parent72e6c72774f65308ce1da807bc0fa5798575d013 (diff)
downloaddokka-cb20227d354b1b74ca6784d55ea75cc8b5281abd.tar.gz
dokka-cb20227d354b1b74ca6784d55ea75cc8b5281abd.tar.bz2
dokka-cb20227d354b1b74ca6784d55ea75cc8b5281abd.zip
Implement simple cli integration test
Diffstat (limited to 'integration-tests/src')
-rw-r--r--integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt39
1 files changed, 39 insertions, 0 deletions
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<File> {
+ return this.walkTopDown().filter { it.isFile && it.extension == extension }
+ }
+
+ fun File.allHtmlFiles(): Sequence<File> {
+ 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
+ )
+ }
+}