diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-11-10 11:46:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 11:46:54 +0100 |
commit | 8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch) | |
tree | 1b915207b2b9f61951ddbf0ff2e687efd053d555 /plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt | |
parent | a44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff) | |
download | dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2 dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip |
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing
* Update Gradle to 8.4
* Refactor and simplify convention plugins and build scripts
Fixes #3132
---------
Co-authored-by: Adam <897017+aSemy@users.noreply.github.com>
Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt deleted file mode 100644 index dce19f70..00000000 --- a/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -package locationProvider - -import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider -import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.pages.* -import org.jetbrains.dokka.plugability.DokkaContext -import kotlin.test.Test -import kotlin.test.assertEquals - -class DokkaLocationProviderTest : BaseAbstractTest() { - - private val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/") - classpath += jvmStdlibPath!! - } - } - } - - private fun getTestLocationProvider(root: RootPageNode, context: DokkaContext? = null): DokkaLocationProvider { - val dokkaContext = context ?: DokkaContext.create(configuration, logger, emptyList()) - return DokkaLocationProvider(root, dokkaContext, ".html") - } - - @DslMarker - annotation class TestNavigationDSL - - @TestNavigationDSL - class NavigationDSL { - companion object { - private val stubDCI = DCI( - setOf( - DRI("kotlin", "Any") - ), - ContentKind.Comment - ) - val stubContentNode = ContentText("", stubDCI, emptySet()) - } - - operator fun invoke(name: String, fn: ModulesDsl.() -> Unit): RendererSpecificRootPage { - val modules = ModulesDsl().also { it.fn() } - return RendererSpecificRootPage(name = name, children = modules.pages, RenderingStrategy.DoNothing) - } - - @TestNavigationDSL - class ModulesDsl(val pages: MutableList<ModulePageNode> = mutableListOf()) { - fun modulePage(name: String, fn: PackageDsl.() -> Unit) { - val packages = PackageDsl().also { it.fn() } - pages.add( - ModulePageNode( - name = name, - children = packages.pages, - content = stubContentNode - ) - ) - } - } - - @TestNavigationDSL - class PackageDsl(val pages: MutableList<PackagePageNode> = mutableListOf()) { - fun packagePage(name: String, fn: ClassDsl.() -> Unit) { - val packages = ClassDsl().also { it.fn() } - pages.add( - PackagePageNode( - name = name, - children = packages.pages, - content = stubContentNode, - dri = emptySet() - ) - ) - } - } - - @TestNavigationDSL - class ClassDsl(val pages: MutableList<ClasslikePageNode> = mutableListOf()) { - fun classPage(name: String) { - pages.add( - ClasslikePageNode( - name = name, - children = emptyList(), - content = stubContentNode, - dri = emptySet() - ) - ) - } - } - } - - @Test - fun `links to a package with or without a class`() { - val root = NavigationDSL()("Root") { - modulePage("Module") { - packagePage("Package") {} - } - } - val packagePage = root.children.first().children.first() as PackagePageNode - val locationProvider = getTestLocationProvider(root) - val resolvedLink = locationProvider.resolve(packagePage) - val localToRoot = locationProvider.pathToRoot(packagePage) - - val rootWithClass = NavigationDSL()("Root") { - modulePage("Module") { - packagePage("Package") { - classPage("ClassA") - } - } - } - val packagePageWithClass = rootWithClass.children.first().children.first() as PackagePageNode - - val locationProviderWithClass = getTestLocationProvider(rootWithClass) - val localToRootWithClass = locationProviderWithClass.pathToRoot(packagePageWithClass) - val resolvedLinkWithClass = locationProviderWithClass.resolve(packagePageWithClass) - - assertEquals("-module/Package.html", resolvedLink) - assertEquals("../", localToRoot) - - assertEquals("-module/Package/index.html", resolvedLinkWithClass) - assertEquals("../../", localToRootWithClass) - } -} |