diff options
Diffstat (limited to 'plugins/base')
4 files changed, 15 insertions, 15 deletions
diff --git a/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt b/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt index 00b865b4..67e62c36 100644 --- a/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt +++ b/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt @@ -3,6 +3,7 @@ package utils import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.OutputWriter import org.jetbrains.dokka.plugability.DokkaPlugin +import java.util.* class TestOutputWriterPlugin(failOnOverwrite: Boolean = true) : DokkaPlugin() { val writer = TestOutputWriter(failOnOverwrite) @@ -19,7 +20,7 @@ class TestOutputWriterPlugin(failOnOverwrite: Boolean = true) : DokkaPlugin() { class TestOutputWriter(private val failOnOverwrite: Boolean = true) : OutputWriter { val contents: Map<String, String> get() = _contents - private val _contents = mutableMapOf<String, String>() + private val _contents = Collections.synchronizedMap(mutableMapOf<String, String>()) override suspend fun write(path: String, text: String, ext: String) { val fullPath = "$path$ext" _contents.putIfAbsent(fullPath, text)?.also { diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt index f25f85a6..096104cc 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt @@ -89,10 +89,7 @@ open class DokkaLocationProvider( private fun PageNode.parent() = pageGraphRoot.parentMap[this] private val PageNode.pathName: String - get() = when (this) { - is PackagePageNode -> if (name.isBlank()) "[root]" else name - else -> identifierToFilename(name) - } + get() = if (this is PackagePageNode) name else identifierToFilename(name) companion object { internal val reservedFilenames = setOf("index", "con", "aux", "lst", "prn", "nul", "eof", "inp", "out") diff --git a/plugins/base/src/test/kotlin/model/PackagesTest.kt b/plugins/base/src/test/kotlin/model/PackagesTest.kt index 188ee2c6..1adf7626 100644 --- a/plugins/base/src/test/kotlin/model/PackagesTest.kt +++ b/plugins/base/src/test/kotlin/model/PackagesTest.kt @@ -22,8 +22,8 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac } } ) { - with((this / "").cast<DPackage>()) { - name equals "" + with((this / "[root]").cast<DPackage>()) { + packageName equals "" children counts 0 } } @@ -38,7 +38,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac prependPackage = false ) { with((this / "simple").cast<DPackage>()) { - name equals "simple" + packageName equals "simple" children counts 0 } } @@ -53,7 +53,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac prependPackage = false ) { with((this / "dot.name").cast<DPackage>()) { - name equals "dot.name" + packageName equals "dot.name" children counts 0 } } @@ -72,11 +72,11 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac ) { children counts 2 with((this / "dot.name").cast<DPackage>()) { - name equals "dot.name" + packageName equals "dot.name" children counts 0 } with((this / "simple").cast<DPackage>()) { - name equals "simple" + packageName equals "simple" children counts 0 } } @@ -94,7 +94,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac ) { children counts 1 with((this / "simple").cast<DPackage>()) { - name equals "simple" + packageName equals "simple" children counts 0 } } @@ -111,12 +111,14 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac prependPackage = false ) { with((this / "simple.name").cast<DPackage>()) { - name equals "simple.name" + packageName equals "simple.name" children counts 1 } } } + // TODO NOW test displayName + // todo // @Test fun suppressAtPackageLevel() { // verifyModel( diff --git a/plugins/base/src/test/kotlin/translators/utils.kt b/plugins/base/src/test/kotlin/translators/utils.kt index 71b4a28b..cbb6efa7 100644 --- a/plugins/base/src/test/kotlin/translators/utils.kt +++ b/plugins/base/src/test/kotlin/translators/utils.kt @@ -20,7 +20,7 @@ fun DModule.descriptionOf(className: String, functionName: String? = null): Desc } fun DModule.findPackage(packageName: String? = null) = - packageName?.let { packages.firstOrNull { pkg -> pkg.name == packageName } + packageName?.let { packages.firstOrNull { pkg -> pkg.packageName == packageName } ?: throw NoSuchElementException("No packageName with name $packageName") } ?: packages.single() fun DModule.findClasslike(packageName: String? = null, className: String? = null): DClasslike { @@ -37,4 +37,4 @@ fun DModule.findFunction(packageName: String? = null, className: String, functio classlike.functions.firstOrNull { fn -> fn.name == functionName } ?: throw NoSuchElementException("No classlike with name $functionName") } ?: classlike.functions.single() -}
\ No newline at end of file +} |