aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/content
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-08-28 19:42:21 +0300
committerGitHub <noreply@github.com>2023-08-28 19:42:21 +0300
commit0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (patch)
tree697b0de0d44b421c922f1f5e6a7c1352f17c68a6 /plugins/base/src/test/kotlin/content
parentbec2cac91726e52884329e7997207e9777abaab7 (diff)
downloaddokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.tar.gz
dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.tar.bz2
dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.zip
Support Dokka K2 analysis (#3094)
Dokka has its own documentable model to represent analyzed code. The analysis is performed by a compiler frontend. In K1 the compiler frontend has descriptors that use the underlying Binding Context (global shared stateful structure). Dokka just maps descriptors to Documentable by DefaultDescriptorToDocumentableTranslator. K2 compiler has FIR tree, which means “Frontend Intermediate Representation”, instead of Binding Context. But we do not use FIR in Dokka directly, since it is too low-level for analysis. The Kotlin compiler provides high-level Analysis API for this case. The API is used by KSP too. Analysis API represent elements of FIR (declarations, parameters and so on) as Symbols. For more details see KtSymbolByFirBuilder, KtSymbol. For Dokka symbol is the replacement of descriptor in K2. Also, to set up the environment of project analysis in K1 we use idea dependencies (or copy-past from there). In K2 for these aims, there is a Standalone mode for Analysis API.
Diffstat (limited to 'plugins/base/src/test/kotlin/content')
-rw-r--r--plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt5
-rw-r--r--plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt10
-rw-r--r--plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt3
7 files changed, 24 insertions, 8 deletions
diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
index 46239baa..82159e0d 100644
--- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
+++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
@@ -10,10 +10,7 @@ import org.jetbrains.dokka.pages.ContentText
import org.jetbrains.dokka.pages.MemberPageNode
import org.jetbrains.dokka.pages.PackagePageNode
import org.junit.jupiter.api.Test
-import utils.ParamAttributes
-import utils.assertNotNull
-import utils.bareSignature
-import utils.propertySignature
+import utils.*
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -318,6 +315,7 @@ class ContentForAnnotationsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `annotated bounds in Java`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt b/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt
index 961ce5f5..c25c1a1b 100644
--- a/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt
+++ b/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt
@@ -9,10 +9,12 @@ import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.pages.ContentStyle
import org.junit.jupiter.api.Test
+import utils.JavaCode
import utils.pWrapped
import kotlin.test.assertEquals
import kotlin.test.assertTrue
+@JavaCode
class JavaDeprecatedTest : BaseAbstractTest() {
private val testConfiguration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
index 14a36611..17bd209e 100644
--- a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
+++ b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
@@ -7,9 +7,7 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.DisplaySourceSet
import org.junit.jupiter.api.Test
-import utils.ParamAttributes
-import utils.bareSignature
-import utils.findTestType
+import utils.*
import kotlin.test.assertEquals
class ContentForExceptions : BaseAbstractTest() {
@@ -55,6 +53,7 @@ class ContentForExceptions : BaseAbstractTest() {
)
}
+ @OnlyDescriptors("Fixed in 1.9.20 (IMPORT STAR)")
@Test
fun `function with navigatable thrown exception`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt b/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt
index e5059073..2994fb42 100644
--- a/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.PluginConfigurationImpl
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
import utils.classSignature
import utils.findTestType
import kotlin.test.assertEquals
@@ -128,6 +129,7 @@ class ContentForInheritorsTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Order of inheritors is different in K2")
@Test
fun `interface with few inheritors has table in description`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index e74cb49d..df5efd03 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -242,6 +242,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `deprecated with multiple links inside`() {
testInline(
@@ -346,6 +347,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `deprecated with an multiple inline links`() {
testInline(
@@ -410,6 +412,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `multiline throws with comment`() {
testInline(
@@ -473,6 +476,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Fixed in 1.9.20 (IMPORT STAR)")
@Test
fun `multiline kotlin throws with comment`() {
testInline(
@@ -590,6 +594,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `multiline throws where exception is not in the same line as description`() {
testInline(
@@ -673,6 +678,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
+ @JavaCode
@Test
fun `documentation splitted in 2 using enters`() {
testInline(
@@ -718,6 +724,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `multiline return tag with param`() {
testInline(
@@ -783,6 +790,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @UsingJDK
@Test
fun `return tag in kotlin`() {
testInline(
@@ -830,6 +838,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `list with links and description`() {
testInline(
@@ -1476,6 +1485,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun javaDocCommentWithDocumentedParameters() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
index 79c1e1ad..82a04b89 100644
--- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
+++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
@@ -171,6 +171,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("No link for `abc` in K1")
@Test
fun `undocumented seealso with reference to parameter for class`() {
testInline(
@@ -201,7 +202,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
header(4) { +"See also" }
table {
group {
- +"abc"
+ +"abc" // link { +"abc" }
}
}
}
@@ -751,6 +752,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptorsMPP
@Test
fun `multiplatform class with seealso in few platforms`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
index 0cf94c18..e57e6a8c 100644
--- a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
+++ b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
@@ -5,6 +5,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.pages.BasicTabbedContentType
import org.jetbrains.dokka.pages.ContentPage
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
class ConstructorsSignaturesTest : BaseAbstractTest() {
private val testConfiguration = dokkaConfiguration {
@@ -157,6 +158,7 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Order of constructors is different in K2")
@Test
fun `class with a parameterless secondary constructor`() {
testInline(
@@ -227,6 +229,7 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
}
+ @OnlyDescriptors("Order of constructors is different in K2")
@Test
fun `class with a few documented constructors`() {
testInline(