Skip to content

Commit

Permalink
[K2] Enable Java tests for symbols (#3203)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmishenev authored Oct 24, 2023
1 parent 820e3b7 commit c745f96
Show file tree
Hide file tree
Showing 27 changed files with 10 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ val symbolsTestConfiguration: Configuration by configurations.creating {

val symbolsTest = tasks.register<Test>("symbolsTest") {
useJUnitPlatform {
excludeTags("onlyDescriptors", "onlyDescriptorsMPP", "javaCode", "usingJDK")
excludeTags("onlyDescriptors", "onlyDescriptorsMPP")
}
classpath += symbolsTestConfiguration
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import utils.ParamAttributes
import utils.assertNotNull
import utils.bareSignature
import utils.propertySignature
import utils.JavaCode
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand Down Expand Up @@ -323,7 +322,6 @@ class ContentForAnnotationsTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `annotated bounds in Java`() {
testInline(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import utils.JavaCode

@JavaCode
class JavaDeprecatedTest : BaseAbstractTest() {

private val testConfiguration = dokkaConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode

@Test
fun `deprecated with multiple links inside`() {
testInline(
Expand Down Expand Up @@ -352,7 +352,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode

@Test
fun `deprecated with an multiple inline links`() {
testInline(
Expand Down Expand Up @@ -417,7 +417,6 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `multiline throws with comment`() {
testInline(
Expand Down Expand Up @@ -599,7 +598,6 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `multiline throws where exception is not in the same line as description`() {
testInline(
Expand Down Expand Up @@ -683,7 +681,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}


@JavaCode

@Test
fun `documentation splitted in 2 using enters`() {
testInline(
Expand Down Expand Up @@ -729,7 +727,6 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `multiline return tag with param`() {
testInline(
Expand Down Expand Up @@ -795,7 +792,6 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@UsingJDK
@Test
fun `return tag in kotlin`() {
testInline(
Expand All @@ -805,7 +801,7 @@ class ContentForParamsTest : BaseAbstractTest() {
| /**
| * a normal comment
| *
| * @return empty string when [Hash Map](java.util.HashMap.containsKey) doesn't contain value.
| * @return empty string when [Hash Map][java.util.HashMap.containsKey] doesn't contain value.
| *
| */
|fun sample(): String {
Expand Down Expand Up @@ -843,7 +839,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode

@Test
fun `list with links and description`() {
testInline(
Expand Down Expand Up @@ -1490,7 +1486,6 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun javaDocCommentWithDocumentedParameters() {
testInline(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import testApi.testRunner.dokkaConfiguration
import kotlin.test.Test
import utils.JavaCode
import kotlin.test.assertEquals

@JavaCode
class JavaVisibilityFilterTest : BaseAbstractTest() {

@Test
Expand Down
3 changes: 1 addition & 2 deletions plugins/base/src/test/kotlin/markdown/LinkTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import org.jetbrains.dokka.pages.MemberPageNode
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import utils.UsingJDK

class LinkTest : BaseAbstractTest() {
@UsingJDK

@Test
fun linkToClassLoader() {
val configuration = dokkaConfiguration {
Expand Down
1 change: 0 additions & 1 deletion plugins/base/src/test/kotlin/model/ClassesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
}
}

@UsingJDK
@Test
fun doublyTypealiasedException() {
inlineModelTest(
Expand Down
2 changes: 0 additions & 2 deletions plugins/base/src/test/kotlin/model/ExtensionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.properties.WithExtraProperties
import utils.AbstractModelTest
import kotlin.test.Test
import utils.UsingJDK

class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") {
private fun <T : WithExtraProperties<R>, R : Documentable> T.checkExtension(name: String = "extension") =
Expand Down Expand Up @@ -71,7 +70,6 @@ class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "cl
}
}

@UsingJDK
@Test
fun `should be extension for external classes`() {
inlineModelTest(
Expand Down
2 changes: 0 additions & 2 deletions plugins/base/src/test/kotlin/model/JavaTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import utils.AbstractModelTest
import utils.assertContains
import utils.assertNotNull
import utils.name
import utils.JavaCode
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

@JavaCode
class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
val configuration = dokkaConfiguration {
sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.utilities.firstIsInstanceOrNull
import translators.documentationOf
import utils.JavaCode
import utils.docs
import kotlin.test.Test
import kotlin.test.assertEquals

@JavaCode
class MultiLanguageInheritanceTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
suppressObviousFunctions = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.utilities.cast
import utils.AbstractModelTest
import kotlin.test.Test
import utils.JavaCode
import kotlin.test.assertEquals
import kotlin.test.assertTrue

@JavaCode
class JavaAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.*
import translators.findClasslike
import kotlin.test.*
import utils.JavaCode

@JavaCode
class JavaAnnotationsTest : BaseAbstractTest() {

val configuration = dokkaConfiguration {
Expand Down
2 changes: 0 additions & 2 deletions plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import utils.text
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import utils.JavaCode

@JavaCode
class JavadocParserTest : BaseAbstractTest() {

private val configuration = dokkaConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package renderers.html

import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import utils.TestOutputWriterPlugin
import utils.UsingJDK
import utils.navigationHtml
import utils.selectNavigationGrid
import kotlin.test.Test
Expand Down Expand Up @@ -187,7 +186,6 @@ class NavigationIconTest : BaseAbstractTest() {
)
}

@UsingJDK
@Test
fun `should add icon styles to kotlin exception class navigation item`() {
assertNavigationIcon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import utils.A
import utils.Span
import utils.TestOutputWriterPlugin
import utils.match
import utils.JavaCode
import kotlin.test.Ignore
import kotlin.test.Test

Expand Down Expand Up @@ -259,7 +258,6 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `java with java function`() {
val source = """
Expand All @@ -286,7 +284,6 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `java with kotlin function`() {
val source = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import utils.A
import utils.Span
import utils.TestOutputWriterPlugin
import utils.match
import utils.JavaCode
import utils.OnlyDescriptors
import kotlin.test.Test
import kotlin.test.assertEquals

@JavaCode
class InheritedAccessorsSignatureTest : BaseAbstractTest() {

private val configuration = dokkaConfiguration {
Expand Down Expand Up @@ -238,7 +236,6 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `should keep kotlin property with no accessors when java inherits kotlin a var`() {
val writerPlugin = TestOutputWriterPlugin()
Expand Down Expand Up @@ -276,7 +273,6 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}

@JavaCode
@Test
fun `kotlin property with compute get and set`() {
val writerPlugin = TestOutputWriterPlugin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.InheritedMember
import org.jetbrains.dokka.model.IsVar
import org.jetbrains.dokka.model.KotlinVisibility
import utils.OnlyDescriptors
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import utils.JavaCode

@JavaCode
class DescriptorSuperPropertiesTest : BaseAbstractTest() {

private val commonTestConfiguration = dokkaConfiguration {
Expand Down Expand Up @@ -145,6 +144,7 @@ class DescriptorSuperPropertiesTest : BaseAbstractTest() {
}

@Test
@OnlyDescriptors("Incorrect test, see https://github.com/Kotlin/dokka/issues/3128")
fun `should have special getter and setter names for boolean property inherited from java`() {
testInline(
"""
Expand Down Expand Up @@ -179,7 +179,7 @@ class DescriptorSuperPropertiesTest : BaseAbstractTest() {
}
}

// incorrect test https://github.com/Kotlin/dokka/issues/3128
@OnlyDescriptors("Incorrect test, see https://github.com/Kotlin/dokka/issues/3128")
@Test
fun `kotlin inheriting java should not append anything since field is public api`() {
val configuration = dokkaConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import utils.JavaCode

@JavaCode
class PsiSuperFieldsTest : BaseAbstractTest() {

private val commonTestConfiguration = dokkaConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import testApi.testRunner.dokkaConfiguration
import utils.JavaCode
import kotlin.test.assertEquals

class ObviousAndInheritedFunctionsDocumentableFilterTest : BaseAbstractTest() {
Expand Down Expand Up @@ -201,7 +200,6 @@ class ObviousAndInheritedFunctionsDocumentableFilterTest : BaseAbstractTest() {

@ParameterizedTest
@MethodSource(value = ["nonSuppressingObviousConfiguration", "nonSuppressingInheritedConfiguration"])
@JavaCode
fun `should not suppress toString, equals and hashcode if custom config is provided in Java`(nonSuppressingConfiguration: DokkaConfigurationImpl) {
testInline(
"""
Expand Down
Loading

0 comments on commit c745f96

Please sign in to comment.