Skip to content

Commit

Permalink
Fix tests for KDoc link to java synthetic properties
Browse files Browse the repository at this point in the history
The tests make explicit the differences in resolving KDoc references to Java synthetic properties between K2 and K1.
  • Loading branch information
vmishenev committed Apr 25, 2024
1 parent d6c9fc8 commit c9a88ad
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions dokka-subprojects/plugin-base/src/test/kotlin/markdown/LinkTest.kt
Expand Up @@ -1066,6 +1066,7 @@ class LinkTest : BaseAbstractTest() {
}

@Test
@OnlySymbols("In K2 KDoc references to java synthetic properties are resolved, but in K1 - no")
fun `KDoc link should lead to java synthetic properties`() {
testInline(
"""
Expand All @@ -1081,7 +1082,42 @@ class LinkTest : BaseAbstractTest() {
|/src/example/Storage.java
|package example;
|class Storage {
| void prop() {}
| void setProp(String value) {}
| void setValue(String value) {}
| String getProp() { return null; }
|}
""".trimMargin(),
configuration
) {
documentablesMergingStage = { module ->
assertEquals(
listOf(
"Storage.setValue" to DRI("example", "Storage", Callable("setValue", null, listOf(TypeConstructor("kotlin.String", emptyList())))),
"Storage.prop" to DRI("example", "Storage", Callable("getProp", null, emptyList()))
),
module.getAllLinkDRIFrom("usage"))
}
}
}

@Test
@OnlyDescriptors("In K2 KDoc references to java synthetic properties are resolved, but in K1 - no")
fun `KDoc link should not lead to java synthetic properties`() {
testInline(
"""
|/src/main/kotlin/Testing.kt
|package example
|
|/**
| * value: [Storage.value] is unresolved
| * setValue: [Storage.setValue]
| * prop: [Storage.prop]
| */
|val usage = 0
|/src/example/Storage.java
|package example;
|class Storage {
| void setProp(String value) {}
| void setValue(String value) {}
| String getProp() { return null; }
|}
Expand All @@ -1092,7 +1128,6 @@ class LinkTest : BaseAbstractTest() {
assertEquals(
listOf(
"Storage.setValue" to DRI("example", "Storage", Callable("setValue", null, listOf(TypeConstructor("kotlin.String", emptyList())))),
"Storage.prop" to DRI("example", "Storage", Callable("prop", null, emptyList()))
),
module.getAllLinkDRIFrom("usage"))
}
Expand Down

0 comments on commit c9a88ad

Please sign in to comment.