aboutsummaryrefslogtreecommitdiff
path: root/core/src/test
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-21 18:58:06 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-21 18:58:06 +0300
commit46af59cc658e4f56b6d2909ab4dc93f43af77dc2 (patch)
tree3f3c104edaca1ade0d0472d417b89fce53eefc96 /core/src/test
parentb6d79cf83917e6a8c843209df3ffa7d9e54d0917 (diff)
downloaddokka-46af59cc658e4f56b6d2909ab4dc93f43af77dc2.tar.gz
dokka-46af59cc658e4f56b6d2909ab4dc93f43af77dc2.tar.bz2
dokka-46af59cc658e4f56b6d2909ab4dc93f43af77dc2.zip
Auto-expand type-aliases excluded from documentation
Diffstat (limited to 'core/src/test')
-rw-r--r--core/src/test/kotlin/TestAPI.kt20
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt27
2 files changed, 41 insertions, 6 deletions
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt
index a1a98ec7..6c62c998 100644
--- a/core/src/test/kotlin/TestAPI.kt
+++ b/core/src/test/kotlin/TestAPI.kt
@@ -151,8 +151,15 @@ fun verifyOutput(roots: Array<ContentRoot>,
withJdk: Boolean = false,
withKotlinRuntime: Boolean = false,
format: String = "html",
+ includeNonPublic: Boolean = true,
outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
- verifyModel(*roots, withJdk = withJdk, withKotlinRuntime = withKotlinRuntime, format = format) {
+ verifyModel(
+ *roots,
+ withJdk = withJdk,
+ withKotlinRuntime = withKotlinRuntime,
+ format = format,
+ includeNonPublic = includeNonPublic
+ ) {
verifyModelOutput(it, outputExtension, roots.first().path, outputGenerator)
}
}
@@ -173,8 +180,17 @@ fun verifyOutput(path: String,
withJdk: Boolean = false,
withKotlinRuntime: Boolean = false,
format: String = "html",
+ includeNonPublic: Boolean = true,
outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
- verifyOutput(arrayOf(contentRootFromPath(path)), outputExtension, withJdk, withKotlinRuntime, format, outputGenerator)
+ verifyOutput(
+ arrayOf(contentRootFromPath(path)),
+ outputExtension,
+ withJdk,
+ withKotlinRuntime,
+ format,
+ includeNonPublic,
+ outputGenerator
+ )
}
fun verifyJavaOutput(path: String,
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index a2891c47..f572922c 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -392,6 +392,10 @@ class MarkdownFormatTest {
verifyMarkdownNode("typeParameterReference")
}
+ @Test fun notPublishedTypeAliasAutoExpansion() {
+ verifyMarkdownNodeByName("notPublishedTypeAliasAutoExpansion", "foo", includeNonPublic = false)
+ }
+
private fun buildMultiplePlatforms(path: String): DocumentationModule {
val module = DocumentationModule("test")
val options = DocumentationOptions("", "html", generateIndexPages = false, noStdlibLink = true)
@@ -428,8 +432,18 @@ class MarkdownFormatTest {
verifyMarkdownNodes(fileName, withKotlinRuntime) { model -> model.members.single().members }
}
- private fun verifyMarkdownNodes(fileName: String, withKotlinRuntime: Boolean = false, nodeFilter: (DocumentationModule) -> List<DocumentationNode>) {
- verifyOutput("testdata/format/$fileName.kt", ".md", withKotlinRuntime = withKotlinRuntime) { model, output ->
+ private fun verifyMarkdownNodes(
+ fileName: String,
+ withKotlinRuntime: Boolean = false,
+ includeNonPublic: Boolean = true,
+ nodeFilter: (DocumentationModule) -> List<DocumentationNode>
+ ) {
+ verifyOutput(
+ "testdata/format/$fileName.kt",
+ ".md",
+ withKotlinRuntime = withKotlinRuntime,
+ includeNonPublic = includeNonPublic
+ ) { model, output ->
markdownService.createOutputBuilder(output, tempLocation).appendNodes(nodeFilter(model))
}
}
@@ -444,8 +458,13 @@ class MarkdownFormatTest {
}
}
- private fun verifyMarkdownNodeByName(fileName: String, name: String, withKotlinRuntime: Boolean = false) {
- verifyMarkdownNodes(fileName, withKotlinRuntime) { model->
+ private fun verifyMarkdownNodeByName(
+ fileName: String,
+ name: String,
+ withKotlinRuntime: Boolean = false,
+ includeNonPublic: Boolean = true
+ ) {
+ verifyMarkdownNodes(fileName, withKotlinRuntime, includeNonPublic) { model->
val nodesWithName = model.members.single().members.filter { it.name == name }
if (nodesWithName.isEmpty()) {
throw IllegalArgumentException("Found no nodes named $name")