aboutsummaryrefslogtreecommitdiff
path: root/test/src/TestAPI.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <intelliyole@gmail.com>2014-12-29 20:31:08 +0100
committerDmitry Jemerov <intelliyole@gmail.com>2014-12-29 20:31:08 +0100
commit41aeba5f437a7d31e4ee34a660e8262ba7d27790 (patch)
treef91f6ee668a88ba5a73c0edd86bd45604d34571f /test/src/TestAPI.kt
parentbadba07c1d151ff5a9cf623abecf7f2c906b5931 (diff)
parentc43a437caa047f787bd3bb84ff612f505d0f8efc (diff)
downloaddokka-41aeba5f437a7d31e4ee34a660e8262ba7d27790.tar.gz
dokka-41aeba5f437a7d31e4ee34a660e8262ba7d27790.tar.bz2
dokka-41aeba5f437a7d31e4ee34a660e8262ba7d27790.zip
Merge pull request #7 from orangy/empty-description
don't generate "Description" header if nothing is going to follow it
Diffstat (limited to 'test/src/TestAPI.kt')
-rw-r--r--test/src/TestAPI.kt17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index 5a4b9863..a16a0b57 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -5,6 +5,8 @@ import com.intellij.openapi.util.*
import kotlin.test.fail
import org.jetbrains.dokka.*
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
+import java.io.File
+import kotlin.test.assertEquals
public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> Unit) {
val messageCollector = object : MessageCollector {
@@ -49,6 +51,15 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) ->
Disposer.dispose(environment)
}
+public fun verifyOutput(path: String, outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
+ verifyModel(path) {
+ val output = StringBuilder()
+ outputGenerator(it, output)
+ val expectedOutput = File(path.replace(".kt", ".md")).readText()
+ assertEquals(expectedOutput, output.toString())
+ }
+}
+
fun StringBuilder.appendChildren(node: ContentNode): StringBuilder {
for (child in node.children) {
val childText = child.toTestString()
@@ -83,3 +94,9 @@ fun ContentNode.toTestString(): String {
appendNode(node)
}.toString()
}
+
+val tempLocation = Location(File("/tmp/out"))
+
+object InMemoryLocationService: LocationService {
+ override fun location(node: DocumentationNode) = tempLocation;
+}