aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt123
1 files changed, 0 insertions, 123 deletions
diff --git a/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt
deleted file mode 100644
index 338e7495..00000000
--- a/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt
+++ /dev/null
@@ -1,123 +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.external.Dokka010ExternalLocationProvider
-import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation
-import org.jetbrains.dokka.base.resolvers.shared.PackageList
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.jetbrains.dokka.links.Callable
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.links.TypeConstructor
-import org.jetbrains.dokka.plugability.DokkaContext
-import java.net.URL
-import kotlin.test.Test
-import kotlin.test.assertEquals
-
-class Dokka010ExternalLocationProviderTest : BaseAbstractTest() {
- private val testDataDir =
- getTestDataDir("locationProvider").toAbsolutePath().toString().removePrefix("/").let { "/$it" }
- private val kotlinLang = "https://kotlinlang.org/api/latest/jvm/stdlib"
- private val packageListURL = URL("file://$testDataDir/old-package-list")
- private val configuration = dokkaConfiguration {
- sourceSets {
- sourceSet {
- sourceRoots = listOf("src/")
- classpath += jvmStdlibPath!!
- }
- }
- }
-
- private fun getTestLocationProvider(context: DokkaContext? = null): Dokka010ExternalLocationProvider {
- val dokkaContext = context ?: DokkaContext.create(configuration, logger, emptyList())
- val packageList = PackageList.load(packageListURL, 8, true)!!
- val externalDocumentation =
- ExternalDocumentation(URL(kotlinLang), packageList)
- return Dokka010ExternalLocationProvider(externalDocumentation, ".html", dokkaContext)
- }
-
- @Test
- fun `ordinary link`() {
- val locationProvider = getTestLocationProvider()
- val dri = DRI("kotlin.reflect", "KVisibility")
-
- assertEquals("$kotlinLang/kotlin.reflect/-k-visibility/index.html", locationProvider.resolve(dri))
- }
-
- @Test
- fun `relocation in package list`() {
- val locationProvider = getTestLocationProvider()
- val dri = DRI("kotlin.text", "StringBuilder")
-
- assertEquals("$kotlinLang/kotlin.relocated.text/-string-builder/index.html", locationProvider.resolve(dri))
- }
-
- @Test
- fun `method relocation in package list`() {
- val locationProvider = getTestLocationProvider()
- val dri = DRI(
- "kotlin",
- "",
- Callable(
- "minus",
- null,
- listOf(
- TypeConstructor("java.math.BigDecimal", emptyList()),
- TypeConstructor("java.math.BigDecimal", emptyList())
- )
- )
- )
-
- assertEquals("$kotlinLang/kotlin/java.math.-big-decimal/minus.html", locationProvider.resolve(dri))
- }
-
- @Test
- fun `#1268 companion part should be stripped`() {
- val locationProvider = getTestLocationProvider()
- val dri = DRI(
- "kotlin",
- "Int.Companion",
- Callable(
- "MIN_VALUE",
- null,
- emptyList()
- )
- )
-
- assertEquals("$kotlinLang/kotlin/-int/-m-i-n_-v-a-l-u-e.html", locationProvider.resolve(dri))
- }
-
- @Test
- fun `companion part should be stripped in relocations`() {
- val locationProvider = getTestLocationProvider()
- val dri = DRI(
- "kotlin",
- "Int.Companion",
- Callable(
- "MAX_VALUE",
- null,
- emptyList()
- )
- )
-
- assertEquals("$kotlinLang/kotlin/-int/max-value.html", locationProvider.resolve(dri))
- }
-
- @Test
- fun `should return null for method not in list`() {
- val locationProvider = getTestLocationProvider()
- val dri = DRI(
- "foo",
- "Bar",
- Callable(
- "baz",
- null,
- emptyList()
- )
- )
-
- assertEquals(null, locationProvider.resolve(dri))
- }
-}