diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-06-30 17:36:22 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-06-30 17:36:22 +0200 |
commit | b96aaa55185152489adfe6682d7aeececfaf12b4 (patch) | |
tree | 7e17b3d995097cda6ae76234edebcc64a9501fd3 /core/src/test/kotlin/TestAPI.kt | |
parent | af27102b662439b4f7ccdeaf2195c93ba533c7be (diff) | |
download | dokka-b96aaa55185152489adfe6682d7aeececfaf12b4.tar.gz dokka-b96aaa55185152489adfe6682d7aeececfaf12b4.tar.bz2 dokka-b96aaa55185152489adfe6682d7aeececfaf12b4.zip |
Don't include internal members in generated javadoc. Resolves #75
Diffstat (limited to 'core/src/test/kotlin/TestAPI.kt')
-rw-r--r-- | core/src/test/kotlin/TestAPI.kt | 75 |
1 files changed, 39 insertions, 36 deletions
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index ab2a526b..508b490a 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -16,11 +16,12 @@ import org.junit.Assert import org.junit.Assert.fail import java.io.File -public fun verifyModel(vararg roots: ContentRoot, - withJdk: Boolean = false, - withKotlinRuntime: Boolean = false, - format: String = "html", - verifier: (DocumentationModule) -> Unit) { +fun verifyModel(vararg roots: ContentRoot, + withJdk: Boolean = false, + withKotlinRuntime: Boolean = false, + format: String = "html", + includeNonPublic: Boolean = true, + verifier: (DocumentationModule) -> Unit) { val messageCollector = object : MessageCollector { override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) { when (severity) { @@ -54,7 +55,7 @@ public fun verifyModel(vararg roots: ContentRoot, addRoots(roots.toList()) } val options = DocumentationOptions("", format, - includeNonPublic = true, + includeNonPublic = includeNonPublic, skipEmptyPackages = false, sourceLinks = listOf<SourceLinkDefinition>(), generateIndexPages = false) @@ -64,11 +65,12 @@ public fun verifyModel(vararg roots: ContentRoot, Disposer.dispose(environment) } -public fun verifyModel(source: String, - withJdk: Boolean = false, - withKotlinRuntime: Boolean = false, - format: String = "html", - verifier: (DocumentationModule) -> Unit) { +fun verifyModel(source: String, + withJdk: Boolean = false, + withKotlinRuntime: Boolean = false, + format: String = "html", + includeNonPublic: Boolean = true, + verifier: (DocumentationModule) -> Unit) { if (!File(source).exists()) { throw IllegalArgumentException("Can't find test data file $source") } @@ -76,22 +78,23 @@ public fun verifyModel(source: String, withJdk = withJdk, withKotlinRuntime = withKotlinRuntime, format = format, + includeNonPublic = includeNonPublic, verifier = verifier) } -public fun verifyPackageMember(source: String, - withJdk: Boolean = false, - withKotlinRuntime: Boolean = false, - verifier: (DocumentationNode) -> Unit) { +fun verifyPackageMember(source: String, + withJdk: Boolean = false, + withKotlinRuntime: Boolean = false, + verifier: (DocumentationNode) -> Unit) { verifyModel(source, withJdk = withJdk, withKotlinRuntime = withKotlinRuntime) { model -> val pkg = model.members.single() verifier(pkg.members.single()) } } -public fun verifyJavaModel(source: String, - withKotlinRuntime: Boolean = false, - verifier: (DocumentationModule) -> Unit) { +fun verifyJavaModel(source: String, + withKotlinRuntime: Boolean = false, + verifier: (DocumentationModule) -> Unit) { val tempDir = FileUtil.createTempDirectory("dokka", "") try { val sourceFile = File(source) @@ -103,20 +106,20 @@ public fun verifyJavaModel(source: String, } } -public fun verifyJavaPackageMember(source: String, - withKotlinRuntime: Boolean = false, - verifier: (DocumentationNode) -> Unit) { +fun verifyJavaPackageMember(source: String, + withKotlinRuntime: Boolean = false, + verifier: (DocumentationNode) -> Unit) { verifyJavaModel(source, withKotlinRuntime) { model -> val pkg = model.members.single() verifier(pkg.members.single()) } } -public fun verifyOutput(roots: Array<ContentRoot>, - outputExtension: String, - withJdk: Boolean = false, - withKotlinRuntime: Boolean = false, - outputGenerator: (DocumentationModule, StringBuilder) -> Unit) { +fun verifyOutput(roots: Array<ContentRoot>, + outputExtension: String, + withJdk: Boolean = false, + withKotlinRuntime: Boolean = false, + outputGenerator: (DocumentationModule, StringBuilder) -> Unit) { verifyModel(*roots, withJdk = withJdk, withKotlinRuntime = withKotlinRuntime) { verifyModelOutput(it, outputExtension, outputGenerator, roots.first().path) } @@ -134,24 +137,24 @@ private fun verifyModelOutput(it: DocumentationModule, assertEqualsIgnoringSeparators(expectedOutput, output.toString()) } -public fun verifyOutput(path: String, - outputExtension: String, - withJdk: Boolean = false, - withKotlinRuntime: Boolean = false, - outputGenerator: (DocumentationModule, StringBuilder) -> Unit) { +fun verifyOutput(path: String, + outputExtension: String, + withJdk: Boolean = false, + withKotlinRuntime: Boolean = false, + outputGenerator: (DocumentationModule, StringBuilder) -> Unit) { verifyOutput(arrayOf(contentRootFromPath(path)), outputExtension, withJdk, withKotlinRuntime, outputGenerator) } -public fun verifyJavaOutput(path: String, - outputExtension: String, - withKotlinRuntime: Boolean = false, - outputGenerator: (DocumentationModule, StringBuilder) -> Unit) { +fun verifyJavaOutput(path: String, + outputExtension: String, + withKotlinRuntime: Boolean = false, + outputGenerator: (DocumentationModule, StringBuilder) -> Unit) { verifyJavaModel(path, withKotlinRuntime) { model -> verifyModelOutput(model, outputExtension, outputGenerator, path) } } -public fun assertEqualsIgnoringSeparators(expectedOutput: String, output: String) { +fun assertEqualsIgnoringSeparators(expectedOutput: String, output: String) { Assert.assertEquals(expectedOutput.replace("\r\n", "\n"), output.replace("\r\n", "\n")) } |