diff options
author | Goooler <wangzongler@gmail.com> | 2022-02-21 22:01:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 17:01:06 +0300 |
commit | f5b7797255576e5f1c230e2ca3fcb5f4e602387c (patch) | |
tree | 25fd98250066c4ed6c2fff1104be533604bbf1b9 /core/test-api/src | |
parent | df4780c31026aaa626746f49f0e6fa3fa0278a05 (diff) | |
download | dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.tar.gz dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.tar.bz2 dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.zip |
Code cleanups (#2165)
Diffstat (limited to 'core/test-api/src')
-rw-r--r-- | core/test-api/src/main/kotlin/testApi/context/MockContext.kt | 2 | ||||
-rw-r--r-- | core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/core/test-api/src/main/kotlin/testApi/context/MockContext.kt b/core/test-api/src/main/kotlin/testApi/context/MockContext.kt index 7b17a8ee..7a3c4786 100644 --- a/core/test-api/src/main/kotlin/testApi/context/MockContext.kt +++ b/core/test-api/src/main/kotlin/testApi/context/MockContext.kt @@ -24,7 +24,7 @@ class MockContext( private val plugins = mutableMapOf<KClass<out DokkaPlugin>, DokkaPlugin>() - override fun <T : DokkaPlugin> plugin(kclass: KClass<T>): T? = plugins.getOrPut(kclass) { + override fun <T : DokkaPlugin> plugin(kclass: KClass<T>): T = plugins.getOrPut(kclass) { kclass.constructors.single { it.parameters.isEmpty() }.call().also { it.injectContext(this) } } as T diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt index c692c83f..de0cd896 100644 --- a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt +++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt @@ -99,14 +99,12 @@ abstract class AbstractTest<M : TestMethods, T : TestBuilder<M>, D : DokkaTestGe .replace("\r\n", "\n") .sliceAt(filePathRegex) .filter { it.isNotEmpty() && it.isNotBlank() && "\n" in it } - .map { fileDeclaration -> fileDeclaration.trim() } - .map { fileDeclaration -> + .map { fileDeclaration -> fileDeclaration.trim() }.associate { fileDeclaration -> val filePathAndContent = fileDeclaration.split("\n", limit = 2) val filePath = filePathAndContent.first().removePrefix("/").trim() val content = filePathAndContent.last().trim() filePath to content } - .toMap() } private fun String.sliceAt(regex: Regex): List<String> { |