Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8ffe63
commit 7a83e46
Showing
8 changed files
with
125 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package linking | ||
|
||
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest | ||
import org.jetbrains.dokka.model.doc.DocumentationLink | ||
import org.junit.jupiter.api.Test | ||
import java.nio.file.Paths | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import java.lang.AssertionError | ||
|
||
class EnumValuesLinking : BaseAbstractTest() { | ||
|
||
@Test | ||
fun `check if enum values are correctly linked`() { | ||
val testDataDir = getTestDataDir("linking").toAbsolutePath() | ||
testFromData( | ||
dokkaConfiguration { | ||
sourceSets { | ||
sourceSet { | ||
sourceRoots = listOf(Paths.get("$testDataDir/jvmMain/kotlin").toString()) | ||
analysisPlatform = "jvm" | ||
name = "jvm" | ||
} | ||
} | ||
} | ||
) { | ||
documentablesTransformationStage = { | ||
val classlikes = it.packages.single().children | ||
assertEquals(4, classlikes.size) | ||
|
||
val javaLinker = classlikes.single { it.name == "JavaLinker" } | ||
javaLinker.documentation.values.single().children.run { | ||
when (val kotlinLink = this[0].children[1].children[1]) { | ||
is DocumentationLink -> kotlinLink.dri.run { | ||
assertEquals("KotlinEnum", this.classNames) | ||
assertEquals("ON_CREATE", this.callable?.name) | ||
} | ||
else -> throw AssertionError("Link node is not DocumentationLink type") | ||
} | ||
|
||
when (val javaLink = this[0].children[2].children[1]) { | ||
is DocumentationLink -> javaLink.dri.run { | ||
assertEquals("JavaEnum", this.classNames) | ||
assertEquals("ON_DECEIT", this.callable?.name) | ||
} | ||
else -> throw AssertionError("Link node is not DocumentationLink type") | ||
} | ||
} | ||
|
||
val kotlinLinker = classlikes.single { it.name == "KotlinLinker" } | ||
kotlinLinker.documentation.values.single().children.run { | ||
when (val kotlinLink = this[0].children[0].children[5]) { | ||
is DocumentationLink -> kotlinLink.dri.run { | ||
assertEquals("KotlinEnum", this.classNames) | ||
assertEquals("ON_CREATE", this.callable?.name) | ||
} | ||
else -> throw AssertionError("Link node is not DocumentationLink type") | ||
} | ||
|
||
when (val javaLink = this[0].children[0].children[9]) { | ||
is DocumentationLink -> javaLink.dri.run { | ||
assertEquals("JavaEnum", this.classNames) | ||
assertEquals("ON_DECEIT", this.callable?.name) | ||
} | ||
else -> throw AssertionError("Link node is not DocumentationLink type") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
plugins/base/src/test/resources/linking/jvmMain/kotlin/linking/source/JavaEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package linking.source; | ||
|
||
public enum JavaEnum { | ||
ON_DECEIT, ON_DESTROY; | ||
} |
8 changes: 8 additions & 0 deletions
8
plugins/base/src/test/resources/linking/jvmMain/kotlin/linking/source/JavaLinker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package linking.source; | ||
|
||
/** | ||
* Reference link {@link linking.source.KotlinEnum} should resolve <p> | ||
* sjuff sjuff {@link linking.source.KotlinEnum#ON_CREATE} should resolve <p> | ||
* sjujj sjujj {@link linking.source.JavaEnum#ON_DECEIT} should resolve | ||
*/ | ||
public class JavaLinker {} |
5 changes: 5 additions & 0 deletions
5
plugins/base/src/test/resources/linking/jvmMain/kotlin/linking/source/KotlinEnum.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package linking.source | ||
|
||
enum class KotlinEnum { | ||
ON_CREATE, ON_CATASTROPHE | ||
} |
8 changes: 8 additions & 0 deletions
8
plugins/base/src/test/resources/linking/jvmMain/kotlin/linking/source/KotlinLinker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package linking.source | ||
|
||
/** | ||
* Reference link [KotlinEnum] should resolve <p> | ||
* stuff stuff [KotlinEnum.ON_CREATE] should resolve <p> | ||
* stuff stuff [JavaEnum.ON_DECEIT] should resolve | ||
*/ | ||
class KotlinLinker {} |