aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/model')
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt38
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt62
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt10
-rw-r--r--plugins/base/src/test/kotlin/model/PropertyTest.kt12
4 files changed, 63 insertions, 59 deletions
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index 4ca34b00..5616a6c3 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -1,5 +1,6 @@
package model
+import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.KotlinModifier.*
import org.junit.jupiter.api.Assertions.assertNull
@@ -150,9 +151,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
visibility.values allEquals KotlinVisibility.Public
- with(extra[AdditionalModifiers].assertNotNull("Extras")) {
- content counts 1
- content.first() equals ExtraModifiers.KotlinOnlyModifiers.Data
+ with(extra[AdditionalModifiers]!!.content.entries.single().value.assertNotNull("Extras")) {
+ this counts 1
+ first() equals ExtraModifiers.KotlinOnlyModifiers.Data
}
}
}
@@ -180,9 +181,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
"""
) {
with((this / "classes" / "Foo").cast<DClass>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- this.content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "Deprecated"
params.entries counts 1
(params["message"].assertNotNull("message") as StringValue).value equals "\"should no longer be used\""
@@ -273,9 +274,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
with((this / "classes" / "C").cast<DClass>()) {
with((this / "D").cast<DClass>()) {
- with(extra[AdditionalModifiers].assertNotNull("AdditionalModifiers")) {
- content counts 1
- content.first() equals ExtraModifiers.KotlinOnlyModifiers.Inner
+ with(extra[AdditionalModifiers]!!.content.entries.single().value.assertNotNull("AdditionalModifiers")) {
+ this counts 1
+ first() equals ExtraModifiers.KotlinOnlyModifiers.Inner
}
}
}
@@ -359,9 +360,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
"""
) {
with((this / "classes" / "C").cast<DClass>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- this.content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "SinceKotlin"
params.entries counts 1
(params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\""
@@ -424,7 +425,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
"""@Suppress("abc") class Foo() {}"""
) {
with((this / "classes" / "Foo").cast<DClass>()) {
- with(extra[Annotations]?.content?.firstOrNull().assertNotNull("annotations")) {
+ with(extra[Annotations]!!.content.entries.single().value.firstOrNull().assertNotNull("annotations")) {
dri.toString() equals "kotlin/Suppress///PointingToDeclaration/"
(params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("\"abc\""))
}
@@ -444,11 +445,14 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
"""
) {
with((this / "classes" / "throws").cast<DAnnotation>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "Retention"
-// params["value"].assertNotNull("value") equals "(java/lang/annotation/RetentionPolicy, SOURCE)"
+ params["value"].assertNotNull("value") equals EnumValue(
+ "RetentionPolicy.SOURCE",
+ DRI("java.lang.annotation", "RetentionPolicy.SOURCE")
+ )
}
}
}
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index 38f64df5..c96e7df6 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -141,9 +141,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f").cast<DFunction>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "Suppress"
params.entries counts 1
(params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("\"FOO\""))
@@ -161,8 +161,8 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f").cast<DFunction>()) {
- extra[AdditionalModifiers]?.content counts 1
- extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Inline
+ extra[AdditionalModifiers]!!.content.entries.single().value counts 1
+ extra[AdditionalModifiers]!!.content.entries.single().value exists ExtraModifiers.KotlinOnlyModifiers.Inline
}
}
}
@@ -175,8 +175,8 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f").cast<DFunction>()) {
- extra[AdditionalModifiers]?.content counts 1
- extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Suspend
+ extra[AdditionalModifiers]!!.content.entries.single().value counts 1
+ extra[AdditionalModifiers]!!.content.entries.single().value exists ExtraModifiers.KotlinOnlyModifiers.Suspend
}
}
}
@@ -189,9 +189,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f").cast<DFunction>()) {
- extra[AdditionalModifiers]?.content counts 2
- extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Suspend
- extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Inline
+ extra[AdditionalModifiers]!!.content.entries.single().value counts 2
+ extra[AdditionalModifiers]!!.content.entries.single().value exists ExtraModifiers.KotlinOnlyModifiers.Suspend
+ extra[AdditionalModifiers]!!.content.entries.single().value exists ExtraModifiers.KotlinOnlyModifiers.Inline
}
}
}
@@ -204,10 +204,10 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f").cast<DFunction>()) {
- with(extra[AdditionalModifiers].assertNotNull("AdditionalModifiers")) {
- content counts 2
- content exists ExtraModifiers.KotlinOnlyModifiers.Suspend
- content exists ExtraModifiers.KotlinOnlyModifiers.Inline
+ with(extra[AdditionalModifiers]!!.content.entries.single().value.assertNotNull("AdditionalModifiers")) {
+ this counts 2
+ this exists ExtraModifiers.KotlinOnlyModifiers.Suspend
+ this exists ExtraModifiers.KotlinOnlyModifiers.Inline
}
}
}
@@ -226,9 +226,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "Fancy").cast<DAnnotation>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- content counts 3
- with(content.map { it.dri.classNames to it }.toMap()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 3
+ with(map { it.dri.classNames to it }.toMap()) {
with(this["Target"].assertNotNull("Target")) {
(params["allowedTargets"].assertNotNull("allowedTargets") as ArrayValue).value equals listOf(
EnumValue(
@@ -249,9 +249,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
}
with((this / "function" / "function" / "notInlined").cast<DParameter>()) {
- with(this.extra[Annotations].assertNotNull("Annotations")) {
- content counts 1
- with(content.first()) {
+ with(this.extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "Fancy"
params.entries counts 0
}
@@ -268,8 +268,8 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f" / "notInlined").cast<DParameter>()) {
- extra[AdditionalModifiers]?.content counts 1
- extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.NoInline
+ extra[AdditionalModifiers]!!.content.entries.single().value counts 1
+ extra[AdditionalModifiers]!!.content.entries.single().value exists ExtraModifiers.KotlinOnlyModifiers.NoInline
}
}
}
@@ -296,9 +296,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
}
}
- with(extra[Annotations].assertNotNull("Annotations")) {
- content counts 3
- with(content.map { it.dri.classNames to it }.toMap()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 3
+ with(map { it.dri.classNames to it }.toMap()) {
with(this["Target"].assertNotNull("Target")) {
(params["allowedTargets"].assertNotNull("allowedTargets") as ArrayValue).value equals listOf(
EnumValue(
@@ -319,9 +319,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
}
with((this / "function" / "f").cast<DFunction>()) {
- with(this.extra[Annotations].assertNotNull("Annotations")) {
- content counts 1
- with(content.first()) {
+ with(this.extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(this.first()) {
dri.classNames equals "Fancy"
params.entries counts 1
(params["size"] as StringValue).value equals "1"
@@ -381,9 +381,9 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
"""
) {
with((this / "function" / "f").cast<DFunction>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- this.content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "SinceKotlin"
params.entries counts 1
(params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\""
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index fd293b5c..8f52fcc8 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -295,9 +295,9 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
"""
) {
with((this / "java" / "C" / "foo").cast<DFunction>()) {
- with(extra[AdditionalModifiers].assertNotNull("AdditionalModifiers")) {
- content counts 1
- content.first() equals ExtraModifiers.JavaOnlyModifiers.Static
+ with(extra[AdditionalModifiers]!!.content.entries.single().value.assertNotNull("AdditionalModifiers")) {
+ this counts 1
+ first() equals ExtraModifiers.JavaOnlyModifiers.Static
}
}
}
@@ -335,8 +335,8 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
"""
) {
with((this / "java" / "Attribute").cast<DAnnotation>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- with(content.single()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ with(single()) {
dri.classNames equals "Target"
(params["value"].assertNotNull("value") as ArrayValue).value equals listOf(
EnumValue("ElementType.FIELD", DRI("java.lang.annotation", "ElementType")),
diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt
index 90a9d782..e384b920 100644
--- a/plugins/base/src/test/kotlin/model/PropertyTest.kt
+++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt
@@ -150,9 +150,9 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
"""
) {
with((this / "property" / "prop").cast<DProperty>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- this.content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "SinceKotlin"
params.entries counts 1
(params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\""
@@ -178,9 +178,9 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
}
) {
with((this / "property" / "property").cast<DProperty>()) {
- with(extra[Annotations].assertNotNull("Annotations")) {
- this.content counts 1
- with(content.first()) {
+ with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) {
+ this counts 1
+ with(first()) {
dri.classNames equals "Strictfp"
params.entries counts 0
}