diff options
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, |