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 /dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.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 'dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.kt')
-rw-r--r-- | dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.kt | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.kt b/dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.kt new file mode 100644 index 00000000..39c893e9 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.kt @@ -0,0 +1,75 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package enums + +import org.jetbrains.dokka.SourceLinkDefinitionImpl +import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import signatures.renderedContent +import utils.TestOutputWriterPlugin +import java.net.URL +import kotlin.test.Test +import kotlin.test.assertEquals + +class JavaEnumsTest : BaseAbstractTest() { + + private val basicConfiguration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/") + } + } + } + + // Shouldn't try to give source links to synthetic methods (values, valueOf) if any are present + // https://github.com/Kotlin/dokka/issues/2544 + @Test + fun `java enum with configured source links should not fail build due to any synthetic methods`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/") + sourceLinks = listOf( + SourceLinkDefinitionImpl( + localDirectory = "src/main/java", + remoteUrl = URL("https://github.com/user/repo/tree/master/src/main/java"), + remoteLineSuffix = "#L" + ) + ) + } + } + } + + val writerPlugin = TestOutputWriterPlugin() + + testInline( + """ + |/src/main/java/basic/JavaEnum.java + |package testpackage + | + |/** + |* doc + |*/ + |public enum JavaEnum { + | ONE, TWO, THREE + |} + """.trimMargin(), + configuration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + val enumPage = writerPlugin.writer.renderedContent("root/testpackage/-java-enum/index.html") + val sourceLink = enumPage.select(".symbol .floating-right") + .select("a[href]") + .attr("href") + + + assertEquals( + "https://github.com/user/repo/tree/master/src/main/java/basic/JavaEnum.java#L6", + sourceLink + ) + } + } + } +} |