diff options
Diffstat (limited to 'plugins/base/src/test/kotlin')
7 files changed, 84 insertions, 52 deletions
diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt index c4640824..98f572b4 100644 --- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt @@ -49,8 +49,9 @@ class ContentForAnnotationsTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { diff --git a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt index 3f0edec3..68042fd4 100644 --- a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt @@ -40,8 +40,9 @@ class ContentForSignaturesTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { @@ -78,7 +79,9 @@ class ContentForSignaturesTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { @@ -115,7 +118,9 @@ class ContentForSignaturesTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { @@ -152,8 +157,9 @@ class ContentForSignaturesTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { @@ -190,7 +196,9 @@ class ContentForSignaturesTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { @@ -227,7 +235,9 @@ class ContentForSignaturesTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - header(1) { +"function" } + group { + header(1) { +"function" } + } divergentGroup { divergentInstance { divergent { diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt index 405ec8b6..4ca34b00 100644 --- a/plugins/base/src/test/kotlin/model/ClassesTest.kt +++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt @@ -152,7 +152,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class visibility.values allEquals KotlinVisibility.Public with(extra[AdditionalModifiers].assertNotNull("Extras")) { content counts 1 - content.first() equals ExtraModifiers.DATA + content.first() equals ExtraModifiers.KotlinOnlyModifiers.Data } } } @@ -185,7 +185,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class with(content.first()) { dri.classNames equals "Deprecated" params.entries counts 1 -// params["message"].assertNotNull("message") equals "should no longer be used" + (params["message"].assertNotNull("message") as StringValue).value equals "\"should no longer be used\"" } } } @@ -275,7 +275,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class with((this / "D").cast<DClass>()) { with(extra[AdditionalModifiers].assertNotNull("AdditionalModifiers")) { content counts 1 - content.first() equals ExtraModifiers.INNER + content.first() equals ExtraModifiers.KotlinOnlyModifiers.Inner } } } @@ -426,9 +426,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class with((this / "classes" / "Foo").cast<DClass>()) { with(extra[Annotations]?.content?.firstOrNull().assertNotNull("annotations")) { dri.toString() equals "kotlin/Suppress///PointingToDeclaration/" -// with(params["names"].assertNotNull("param")) { -// this equals "[\"abc\"]" -// } + (params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("\"abc\"")) } } } diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt index 6cbb84f7..38f64df5 100644 --- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt +++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt @@ -1,5 +1,6 @@ package model +import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.junit.jupiter.api.Test import utils.AbstractModelTest @@ -145,7 +146,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun with(content.first()) { dri.classNames equals "Suppress" params.entries counts 1 -// params["names"].assertNotNull("names") equals "[\"FOO\"]" + (params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("\"FOO\"")) } } } @@ -161,7 +162,7 @@ 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.INLINE + extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Inline } } } @@ -175,7 +176,7 @@ 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.SUSPEND + extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Suspend } } } @@ -189,8 +190,8 @@ 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.SUSPEND - extra[AdditionalModifiers]?.content exists ExtraModifiers.INLINE + extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Suspend + extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.Inline } } } @@ -205,8 +206,8 @@ 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.SUSPEND - content exists ExtraModifiers.INLINE + content exists ExtraModifiers.KotlinOnlyModifiers.Suspend + content exists ExtraModifiers.KotlinOnlyModifiers.Inline } } } @@ -229,10 +230,18 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun content counts 3 with(content.map { it.dri.classNames to it }.toMap()) { with(this["Target"].assertNotNull("Target")) { -// params["allowedTargets"].assertNotNull("allowedTargets") equals "[AnnotationTarget.VALUE_PARAMETER]" + (params["allowedTargets"].assertNotNull("allowedTargets") as ArrayValue).value equals listOf( + EnumValue( + "AnnotationTarget.VALUE_PARAMETER", + DRI("kotlin.annotation", "AnnotationTarget.VALUE_PARAMETER") + ) + ) } with(this["Retention"].assertNotNull("Retention")) { -// params["value"].assertNotNull("value") equals "(kotlin/annotation/AnnotationRetention, SOURCE)" + (params["value"].assertNotNull("value") as EnumValue) equals EnumValue( + "AnnotationRetention.SOURCE", + DRI("kotlin.annotation", "AnnotationRetention.SOURCE") + ) } this["MustBeDocumented"].assertNotNull("MustBeDocumented").params.entries counts 0 } @@ -260,7 +269,7 @@ 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.NOINLINE + extra[AdditionalModifiers]?.content exists ExtraModifiers.KotlinOnlyModifiers.NoInline } } } @@ -291,10 +300,18 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun content counts 3 with(content.map { it.dri.classNames to it }.toMap()) { with(this["Target"].assertNotNull("Target")) { -// params["allowedTargets"].assertNotNull("allowedTargets") equals "[AnnotationTarget.VALUE_PARAMETER]" + (params["allowedTargets"].assertNotNull("allowedTargets") as ArrayValue).value equals listOf( + EnumValue( + "AnnotationTarget.VALUE_PARAMETER", + DRI("kotlin.annotation", "AnnotationTarget.VALUE_PARAMETER") + ) + ) } with(this["Retention"].assertNotNull("Retention")) { -// params["value"].assertNotNull("value") equals "(kotlin/annotation/AnnotationRetention, SOURCE)" + (params["value"].assertNotNull("value") as EnumValue) equals EnumValue( + "AnnotationRetention.SOURCE", + DRI("kotlin.annotation", "AnnotationRetention.SOURCE") + ) } this["MustBeDocumented"].assertNotNull("MustBeDocumented").params.entries counts 0 } @@ -307,7 +324,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun with(content.first()) { dri.classNames equals "Fancy" params.entries counts 1 -// params["size"] equals "1" + (params["size"] as StringValue).value equals "1" } } } @@ -369,7 +386,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun with(content.first()) { dri.classNames equals "SinceKotlin" params.entries counts 1 -// params["version"].assertNotNull("version") equals "1.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 07af7913..fd293b5c 100644 --- a/plugins/base/src/test/kotlin/model/JavaTest.kt +++ b/plugins/base/src/test/kotlin/model/JavaTest.kt @@ -1,9 +1,9 @@ package model import org.jetbrains.dokka.base.transformers.documentables.InheritorsInfo +import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import utils.AbstractModelTest import utils.assertNotNull @@ -297,7 +297,7 @@ 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.STATIC + content.first() equals ExtraModifiers.JavaOnlyModifiers.Static } } } @@ -338,7 +338,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { with(extra[Annotations].assertNotNull("Annotations")) { with(content.single()) { dri.classNames equals "Target" -// params["value"].assertNotNull("value") equals "{ElementType.FIELD, ElementType.TYPE, ElementType.METHOD}" + (params["value"].assertNotNull("value") as ArrayValue).value equals listOf( + EnumValue("ElementType.FIELD", DRI("java.lang.annotation", "ElementType")), + EnumValue("ElementType.TYPE", DRI("java.lang.annotation", "ElementType")), + EnumValue("ElementType.METHOD", 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 7429257b..90a9d782 100644 --- a/plugins/base/src/test/kotlin/model/PropertyTest.kt +++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt @@ -155,7 +155,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro with(content.first()) { dri.classNames equals "SinceKotlin" params.entries counts 1 -// params["version"].assertNotNull("version") equals "1.1" + (params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\"" } } } diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt index a1141832..ec119ebb 100644 --- a/plugins/base/src/test/kotlin/utils/contentUtils.kt +++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt @@ -139,26 +139,28 @@ fun ContentMatcherBuilder<*>.propertySignature( header { +"Package test" } } group { - skipAllNotMatching() - header { +"Properties" } - table { - group { - link { +name } - platformHinted { - group { + group { + skipAllNotMatching() + header { +"Properties" } + table { + group { + link { +name } + platformHinted { group { - annotations.entries.forEach { - group { - unwrapAnnotation(it) + group { + annotations.entries.forEach { + group { + unwrapAnnotation(it) + } } - } - +("$visibility $modifier ${keywords.joinToString("") { "$it " }} $preposition") - link { +name } - if (type != null) { - +(": ") - group { - link { - +(type) + +("$visibility $modifier ${keywords.joinToString("") { "$it " }} $preposition") + link { +name } + if (type != null) { + +(": ") + group { + link { + +(type) + } } } } |