diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-07-03 16:18:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-03 16:18:43 +0300 |
commit | cbd9733d3dd2f52992e98e7cebd072091a572529 (patch) | |
tree | d7142fb1c8b83b9f4c2d8abb873f8847c427a0d5 /plugins/base/src/test/kotlin/transformers | |
parent | 12a386bb7185f862a1cbd831e6856c4235953833 (diff) | |
download | dokka-cbd9733d3dd2f52992e98e7cebd072091a572529.tar.gz dokka-cbd9733d3dd2f52992e98e7cebd072091a572529.tar.bz2 dokka-cbd9733d3dd2f52992e98e7cebd072091a572529.zip |
Enhance typealias presentation (#3053)
Diffstat (limited to 'plugins/base/src/test/kotlin/transformers')
-rw-r--r-- | plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt index 81b4db69..11996186 100644 --- a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt +++ b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt @@ -1,5 +1,6 @@ package transformers +import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.SourceLinkDefinitionImpl import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.junit.jupiter.api.Test @@ -64,4 +65,63 @@ class SourceLinkTransformerTest : BaseAbstractTest() { } } } + + @Test + fun `source link should be for actual typealias`() { + val mppConfiguration = dokkaConfiguration { + moduleName = "test" + sourceSets { + sourceSet { + name = "common" + sourceRoots = listOf("src/main/kotlin/common/Test.kt") + classpath = listOf(commonStdlibPath!!) + externalDocumentationLinks = listOf(stdlibExternalDocumentationLink) + } + sourceSet { + name = "jvm" + dependentSourceSets = setOf(DokkaSourceSetID("test", "common")) + sourceRoots = listOf("src/main/kotlin/jvm/Test.kt") + classpath = listOf(commonStdlibPath!!) + externalDocumentationLinks = listOf(stdlibExternalDocumentationLink) + sourceLinks = listOf( + SourceLinkDefinitionImpl( + localDirectory = "src/main/kotlin", + remoteUrl = URL("https://github.com/user/repo/tree/master/src/main/kotlin"), + remoteLineSuffix = "#L" + ) + ) + } + } + } + + val writerPlugin = TestOutputWriterPlugin() + + testInline( + """ + |/src/main/kotlin/common/Test.kt + |package example + | + |expect class Foo + | + |/src/main/kotlin/jvm/Test.kt + |package example + | + |class Bar + |actual typealias Foo = Bar + | + """.trimMargin(), + mppConfiguration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + val page = writerPlugin.writer.renderedContent("test/example/-foo/index.html") + val sourceLink = page.getSourceLink() + + assertEquals( + "https://github.com/user/repo/tree/master/src/main/kotlin/jvm/Test.kt#L4", + sourceLink + ) + } + } + } }
\ No newline at end of file |