diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-07-27 23:42:07 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-19 13:34:10 +0200 |
commit | b12d8878aa072e3c71f2a9204040da6bfa3e5a11 (patch) | |
tree | 8f04c239bd3028ca096c7c106aa4cb0e188c1c6d | |
parent | fc38ceda06d92978175d37bb7197763539c966a2 (diff) | |
download | dokka-b12d8878aa072e3c71f2a9204040da6bfa3e5a11.tar.gz dokka-b12d8878aa072e3c71f2a9204040da6bfa3e5a11.tar.bz2 dokka-b12d8878aa072e3c71f2a9204040da6bfa3e5a11.zip |
Fix tests containing unresolved links
3 files changed, 20 insertions, 104 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index d23c45e9..1f875a0d 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -8,6 +8,15 @@ import org.junit.jupiter.api.Test import utils.* class SignatureTest : AbstractCoreTest() { + private val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/main/kotlin/test/Test.kt") + classpath = listOf(commonStdlibPath!!) + externalDocumentationLinks = listOf(stdlibExternalDocumentationLink) + } + } + } fun source(signature: String) = """ @@ -19,15 +28,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("fun simpleFun(): String = \"Celebrimbor\"") val writerPlugin = TestOutputWriterPlugin() @@ -46,15 +46,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `open fun`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("open fun simpleFun(): String = \"Celebrimbor\"") val writerPlugin = TestOutputWriterPlugin() @@ -73,15 +64,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `open suspend fun`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("open suspend fun simpleFun(): String = \"Celebrimbor\"") val writerPlugin = TestOutputWriterPlugin() @@ -100,15 +82,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with params`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("fun simpleFun(a: Int, b: Boolean, c: Any): String = \"Celebrimbor\"") val writerPlugin = TestOutputWriterPlugin() @@ -129,15 +102,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with function param`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("fun simpleFun(a: (Int) -> String): String = \"Celebrimbor\"") val writerPlugin = TestOutputWriterPlugin() @@ -157,15 +121,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with generic param`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("fun <T> simpleFun(): T = \"Celebrimbor\" as T") val writerPlugin = TestOutputWriterPlugin() @@ -185,15 +140,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with generic bounded param`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("fun <T : String> simpleFun(): T = \"Celebrimbor\" as T") val writerPlugin = TestOutputWriterPlugin() @@ -213,15 +159,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with keywords, params and generic bound`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = source("inline suspend fun <T : String> simpleFun(a: Int, b: String): T = \"Celebrimbor\" as T") val writerPlugin = TestOutputWriterPlugin() @@ -296,15 +233,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with annotation`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = """ |/src/main/kotlin/test/Test.kt |package example @@ -337,15 +265,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with two annotations`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = """ |/src/main/kotlin/test/Test.kt |package example @@ -386,15 +305,6 @@ class SignatureTest : AbstractCoreTest() { @Test fun `fun with annotation with array`() { - - val configuration = dokkaConfiguration { - sourceSets { - sourceSet { - sourceRoots = listOf("src/main/kotlin/test/Test.kt") - } - } - } - val source = """ |/src/main/kotlin/test/Test.kt |package example diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt index 463ad7fd..1e161666 100644 --- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt @@ -93,7 +93,7 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest( 0, assertIsInstance<List<*>>(method["parameters"]).size, "Expected no parameters" ) - assertEquals("final <a href=.html>String</a>", method.modifiers()) + assertEquals("final String", method.modifiers()) assertEquals("<a href=TestClass.html#testFunction()>testFunction</a>()", method.signatureWithoutModifiers()) } } @@ -257,19 +257,19 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest( assertParameterNode( node = first, expectedName = "simple", - expectedType = "<a href=.html>String</a>", + expectedType = "String", expectedDescription = "simple String parameter" ) assertParameterNode( node = second, expectedName = "parameters", - expectedType = "<a href=.html>Integer</a>", + expectedType = "Integer", expectedDescription = "simple Integer parameter" ) assertParameterNode( node = third, expectedName = "list", - expectedType = "<a href=.html>Boolean</a>", + expectedType = "Boolean", expectedDescription = "simple Boolean parameter" ) } @@ -305,7 +305,7 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest( assertEquals("Generic", map["name"]) assertEquals( - "public final class <a href=Generic.html>Generic</a><T extends <a href=.html>Serializable</a>>", + "public final class <a href=Generic.html>Generic</a><T extends Serializable>", map.signatureWithModifiers() ) val methods = assertIsInstance<Map<Any, Any?>>(map["methods"]) diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt index 995bd949..333642b1 100644 --- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt +++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt @@ -12,6 +12,7 @@ import org.jetbrains.dokka.utilities.DokkaConsoleLogger import org.jetbrains.dokka.utilities.DokkaLogger import org.junit.rules.TemporaryFolder import java.io.File +import java.net.URL import java.nio.charset.Charset import java.nio.file.Files import java.nio.file.InvalidPathException @@ -261,6 +262,11 @@ abstract class AbstractCoreTest( ?.replaceAfter(".jar", "") } + protected val stdlibExternalDocumentationLink = ExternalDocumentationLinkImpl( + URL("https://kotlinlang.org/api/latest/jvm/stdlib/"), + URL("https://kotlinlang.org/api/latest/jvm/stdlib/package-list") + ) + companion object { private val filePathRegex = Regex("""[\n^](/\w+)+(\.\w+)?\s*\n""") } |