diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-05-28 21:12:50 +0200 |
---|---|---|
committer | Paweł Marks <pmarks@virtuslab.com> | 2020-06-12 14:15:24 +0200 |
commit | dd44b839eac1b7b647e97f2cc73dd96bd054713b (patch) | |
tree | 6ab5a393c2a7d926519626f5f45f5c8b8cd60505 /plugins/base/src/test/kotlin/model/ClassesTest.kt | |
parent | d7be30c841cb925fd0d6322ccdd9877169730b92 (diff) | |
download | dokka-dd44b839eac1b7b647e97f2cc73dd96bd054713b.tar.gz dokka-dd44b839eac1b7b647e97f2cc73dd96bd054713b.tar.bz2 dokka-dd44b839eac1b7b647e97f2cc73dd96bd054713b.zip |
Refactor of Annotations and ExtraModifiers to be platform depedent
Diffstat (limited to 'plugins/base/src/test/kotlin/model/ClassesTest.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/model/ClassesTest.kt | 38 |
1 files changed, 21 insertions, 17 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") + ) } } } |