diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-09-08 00:13:13 +0200 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-09-30 13:43:08 +0200 |
commit | adf99ba137bc6e40c3add9df70f906a16f9199a4 (patch) | |
tree | 755353814f7fa0ae45cdd7a7abbabdb47323d2ea | |
parent | 33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6 (diff) | |
download | dokka-adf99ba137bc6e40c3add9df70f906a16f9199a4.tar.gz dokka-adf99ba137bc6e40c3add9df70f906a16f9199a4.tar.bz2 dokka-adf99ba137bc6e40c3add9df70f906a16f9199a4.zip |
Add tests for relocations in ExternalLocationProviders
-rw-r--r-- | plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt | 16 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt | 13 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt | 21 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt (renamed from plugins/base/src/test/kotlin/locationProvider/DefaultLocationProviderTest.kt) | 2 |
4 files changed, 45 insertions, 7 deletions
diff --git a/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt index ea2c434f..b2cfe176 100644 --- a/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt @@ -86,4 +86,20 @@ class AndroidExternalLocationProviderTest : AbstractCoreTest() { locationProvider.resolve(dri) ) } + + @Test + fun `should return null for method not in list`() { + val locationProvider = getTestLocationProvider(android) + val dri = DRI( + "foo", + "Bar", + Callable( + "baz", + null, + emptyList() + ) + ) + + assertEquals(null, locationProvider.resolve(dri)) + } } diff --git a/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt index bfa60d24..7d21e0a7 100644 --- a/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt @@ -1,6 +1,5 @@ package locationProvider -import org.jetbrains.dokka.ExternalDocumentationLink import org.jetbrains.dokka.base.resolvers.external.DefaultExternalLocationProvider import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.base.resolvers.shared.PackageList @@ -23,7 +22,6 @@ class DefaultExternalLocationProviderTest : AbstractCoreTest() { sourceSet { sourceRoots = listOf("src/") classpath += jvmStdlibPath!! - ExternalDocumentationLink(kotlinLang, packageListURL.toString()) } } } @@ -62,4 +60,15 @@ class DefaultExternalLocationProviderTest : AbstractCoreTest() { assertEquals("$kotlinLang/kotlin-stdlib/[JS root]/long-array.html", locationProvider.resolve(dri)) } + + @Test + fun `should return null for class not in list`() { + val locationProvider = getTestLocationProvider() + val dri = DRI( + "foo", + "Bar" + ) + + assertEquals(null, locationProvider.resolve(dri)) + } } diff --git a/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt index 31ffa0b3..165c7c15 100644 --- a/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt @@ -1,15 +1,13 @@ package locationProvider -import org.jetbrains.dokka.ExternalDocumentationLink import org.jetbrains.dokka.base.resolvers.external.Dokka010ExternalLocationProvider -import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.base.resolvers.shared.PackageList 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 org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import java.net.URL @@ -24,7 +22,6 @@ class Dokka010ExternalLocationProviderTest : AbstractCoreTest() { sourceSet { sourceRoots = listOf("src/") classpath += jvmStdlibPath!! - ExternalDocumentationLink(kotlinLang, packageListURL.toString()) } } } @@ -103,4 +100,20 @@ class Dokka010ExternalLocationProviderTest : AbstractCoreTest() { 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)) + } } diff --git a/plugins/base/src/test/kotlin/locationProvider/DefaultLocationProviderTest.kt b/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt index 6426c0e1..b35310a5 100644 --- a/plugins/base/src/test/kotlin/locationProvider/DefaultLocationProviderTest.kt +++ b/plugins/base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt @@ -1,8 +1,8 @@ package locationProvider -import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider import org.jetbrains.dokka.model.dfs +import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test |