diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-03-09 17:47:09 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-03-20 18:20:19 +0300 |
commit | 2eb805e47505388c0e47102e9257f6f79681e699 (patch) | |
tree | b50cc77717f4c9565579419ad197f21ec7938d24 /core/src/test | |
parent | 8eff2cf33d1ba671191d6e2873f005e6b5f7057e (diff) | |
download | dokka-2eb805e47505388c0e47102e9257f6f79681e699.tar.gz dokka-2eb805e47505388c0e47102e9257f6f79681e699.tar.bz2 dokka-2eb805e47505388c0e47102e9257f6f79681e699.zip |
Create HTML based format for kotlin-website
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt new file mode 100644 index 00000000..5c2fbe75 --- /dev/null +++ b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt @@ -0,0 +1,74 @@ +package org.jetbrains.dokka.tests + +import org.jetbrains.dokka.* +import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList +import org.junit.Test + +class KotlinWebSiteHtmlFormatTest { + private val kwsService = KotlinWebsiteHtmlFormatService(InMemoryLocationService, KotlinLanguageService(), listOf()) + + + @Test fun dropImport() { + verifyKWSNodeByName("dropImport", "foo") + } + + @Test fun sample() { + verifyKWSNodeByName("sample", "foo") + } + + @Test fun sampleWithAsserts() { + verifyKWSNodeByName("sampleWithAsserts", "a") + } + + @Test fun newLinesInSamples() { + verifyKWSNodeByName("newLinesInSamples", "foo") + } + + @Test fun newLinesInImportList() { + verifyKWSNodeByName("newLinesInImportList", "foo") + } + + @Test fun returnTag() { + verifyKWSNodeByName("returnTag", "indexOf") + } + + @Test fun overloadGroup() { + verifyKWSNodeByName("overloadGroup", "magic") + } + + @Test fun dataTags() { + val module = buildMultiplePlatforms("dataTags") + verifyMultiplatformPackage(module, "dataTags") + } + + @Test fun dataTagsInGroupNode() { + val path = "dataTagsInGroupNode" + val module = buildMultiplePlatforms(path) + verifyModelOutput(module, ".html", "testdata/format/website-html/$path/multiplatform.kt") { model, output -> + kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.find { it.kind == NodeKind.GroupNode }.singletonOrEmptyList()) + } + verifyMultiplatformPackage(module, path) + } + + private fun verifyKWSNodeByName(fileName: String, name: String) { + verifyOutput("testdata/format/website-html/$fileName.kt", ".html", format = "kotlin-website-html") { model, output -> + kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) + } + } + + private fun buildMultiplePlatforms(path: String): DocumentationModule { + val module = DocumentationModule("test") + val options = DocumentationOptions("", "html", generateIndexPages = false) + appendDocumentation(module, contentRootFromPath("testdata/format/website-html/$path/jvm.kt"), defaultPlatforms = listOf("JVM"), options = options) + appendDocumentation(module, contentRootFromPath("testdata/format/website-html/$path/jre7.kt"), defaultPlatforms = listOf("JVM", "JRE7"), options = options) + appendDocumentation(module, contentRootFromPath("testdata/format/website-html/$path/js.kt"), defaultPlatforms = listOf("JS"), options = options) + return module + } + + private fun verifyMultiplatformPackage(module: DocumentationModule, path: String) { + verifyModelOutput(module, ".package.html", "testdata/format/website-html/$path/multiplatform.kt") { model, output -> + kwsService.createOutputBuilder(output, tempLocation).appendNodes(model.members) + } + } + +} |