From 3c6624aa876b9b55baa32b121240f7bc7eda8116 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Tue, 24 Mar 2020 11:02:56 +0100 Subject: Fix link parsing for links with fq names --- plugins/base/src/test/kotlin/markdown/KDocTest.kt | 2 +- plugins/base/src/test/kotlin/markdown/LinkTest.kt | 46 +++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 plugins/base/src/test/kotlin/markdown/LinkTest.kt (limited to 'plugins/base/src') diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt index a904f725..f9d717b0 100644 --- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt +++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt @@ -6,7 +6,7 @@ import org.jetbrains.dokka.pages.ModulePageNode import org.junit.jupiter.api.Assertions.* import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest -open class KDocTest : AbstractCoreTest() { +abstract class KDocTest : AbstractCoreTest() { private val configuration = dokkaConfiguration { passes { diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt new file mode 100644 index 00000000..d38486b5 --- /dev/null +++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt @@ -0,0 +1,46 @@ +package markdown + +import org.jetbrains.dokka.pages.ContentDRILink +import org.jetbrains.dokka.pages.MemberPageNode +import org.jetbrains.dokka.pages.dfs +import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test + +class LinkTest : AbstractCoreTest() { + @Test + fun linkToClassLoader() { + val configuration = dokkaConfiguration { + passes { + pass { + sourceRoots = listOf("src/main/kotlin/parser") + } + } + } + testInline( + """ + |/src/main/kotlin/parser/Test.kt + |package parser + | + | /** + | * Some docs that link to [ClassLoader.clearAssertionStatus] + | */ + |fun test(x: ClassLoader) = x.clearAssertionStatus() + | + """.trimMargin(), + configuration + ) { + renderingStage = { rootPageNode, _ -> + (rootPageNode.children.single().children.single() as MemberPageNode) + .content + .dfs { node -> node is ContentDRILink } + .let { + assertEquals( + "parser//test/#java.lang.ClassLoader//", + (it as ContentDRILink).address.toString() + ) + } + } + } + } +} \ No newline at end of file -- cgit