diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-06-05 09:07:20 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-06-10 10:52:43 +0200 |
commit | e9fd8b7bc00491b50e4822acc82e5615ab0bde3b (patch) | |
tree | 27648e766764df986a154e6c3353d634d219c0bc /testApi/src | |
parent | 77c8777b7f66bddd374d68decd507547d356d602 (diff) | |
download | dokka-e9fd8b7bc00491b50e4822acc82e5615ab0bde3b.tar.gz dokka-e9fd8b7bc00491b50e4822acc82e5615ab0bde3b.tar.bz2 dokka-e9fd8b7bc00491b50e4822acc82e5615ab0bde3b.zip |
Implement `reportUndocumented` option to report undocumented code
Diffstat (limited to 'testApi/src')
-rw-r--r-- | testApi/src/main/kotlin/testApi/logger/TestLogger.kt | 53 | ||||
-rw-r--r-- | testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt | 6 |
2 files changed, 57 insertions, 2 deletions
diff --git a/testApi/src/main/kotlin/testApi/logger/TestLogger.kt b/testApi/src/main/kotlin/testApi/logger/TestLogger.kt new file mode 100644 index 00000000..8f88f88b --- /dev/null +++ b/testApi/src/main/kotlin/testApi/logger/TestLogger.kt @@ -0,0 +1,53 @@ +package testApi.logger + +import org.jetbrains.dokka.utilities.DokkaLogger + +class TestLogger(private val logger: DokkaLogger) : DokkaLogger { + override var warningsCount: Int by logger::warningsCount + override var errorsCount: Int by logger::errorsCount + + private var _debugMessages = mutableListOf<String>() + val debugMessages: List<String> get() = _debugMessages.toList() + + private var _infoMessages = mutableListOf<String>() + val infoMessages: List<String> get() = _infoMessages.toList() + + private var _progressMessages = mutableListOf<String>() + val progressMessages: List<String> get() = _progressMessages.toList() + + private var _warnMessages = mutableListOf<String>() + val warnMessages: List<String> get() = _warnMessages.toList() + + private var _errorMessages = mutableListOf<String>() + val errorMessages: List<String> get() = _errorMessages.toList() + + override fun debug(message: String) { + _debugMessages.add(message) + logger.debug(message) + } + + override fun info(message: String) { + _infoMessages.add(message) + logger.info(message) + } + + override fun progress(message: String) { + _progressMessages.add(message) + logger.progress(message) + } + + override fun warn(message: String) { + _warnMessages.add(message) + logger.warn(message) + } + + override fun error(message: String) { + _errorMessages.add(message) + logger.error(message) + } + + override fun report() { + logger.report() + } + +}
\ No newline at end of file diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt index 187f718b..7f1be6b5 100644 --- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt +++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt @@ -10,6 +10,7 @@ import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.junit.rules.TemporaryFolder +import testApi.logger.TestLogger import java.io.File import java.nio.charset.Charset import java.nio.file.Files @@ -19,7 +20,7 @@ import java.nio.file.Paths // TODO: take dokka configuration from file abstract class AbstractCoreTest { - protected val logger = DokkaConsoleLogger + protected val logger = TestLogger(DokkaConsoleLogger) protected fun getTestDataDir(name: String) = File("src/test/resources/$name").takeIf { it.exists() }?.toPath() @@ -114,7 +115,8 @@ abstract class AbstractCoreTest { var pagesTransformationStage: (RootPageNode) -> Unit = {} var renderingStage: (RootPageNode, DokkaContext) -> Unit = { a, b -> } - fun build() = TestMethods( + @PublishedApi + internal fun build() = TestMethods( analysisSetupStage, pluginsSetupStage, documentablesCreationStage, |