diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-07-26 16:18:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 16:18:35 +0300 |
commit | 2c01749e5213e030ca32dd04058d478a65951fed (patch) | |
tree | f4050f25d1ecfe05a289dc38ffebb8cccc63fea1 /plugins/base | |
parent | 900fbccf3da483946227d99ce52b71afe0e62007 (diff) | |
download | dokka-2c01749e5213e030ca32dd04058d478a65951fed.tar.gz dokka-2c01749e5213e030ca32dd04058d478a65951fed.tar.bz2 dokka-2c01749e5213e030ca32dd04058d478a65951fed.zip |
Fix some tests to be compatible with K2 (#3086)
Diffstat (limited to 'plugins/base')
5 files changed, 22 insertions, 19 deletions
diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt index 2659fd86..46239baa 100644 --- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt @@ -180,7 +180,7 @@ class ContentForAnnotationsTest : BaseAbstractTest() { | |@MustBeDocumented |@Retention(AnnotationRetention.SOURCE) - |@Target(AnnotationTarget.FIELD) + |@Target(AnnotationTarget.PROPERTY) |annotation class BugReport( | val assignedTo: String = "[none]", | val testCase: KClass<ABC> = ABC::class, diff --git a/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt b/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt index 83517254..417843e2 100644 --- a/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt @@ -33,7 +33,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { testInline( """ |/src/main/kotlin/kotlin/KotlinFile.kt - |package kotlin + |package deprecated | |@Deprecated( | message = "Fancy message" @@ -44,7 +44,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { ) { documentablesTransformationStage = { module -> val deprecatedFunction = module.children - .single { it.name == "kotlin" }.children + .single { it.name == "deprecated" }.children .single { it.name == "simpleFunction" } val isDeprecated = (deprecatedFunction as WithExtraProperties<out Documentable>).isDeprecated() @@ -65,7 +65,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { testInline( """ |/src/main/kotlin/kotlin/DeprecatedKotlin.kt - |package kotlin + |package deprecated | |/** | * Average function description @@ -84,7 +84,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { ) { pagesTransformationStage = { module -> val functionWithDeprecatedFunction = module.children - .single { it.name == "kotlin" }.children + .single { it.name == "deprecated" }.children .single { it.name == "oldLegacyFunction" } as ContentPage functionWithDeprecatedFunction.content.assertNode { @@ -130,7 +130,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { testInline( """ |/src/main/kotlin/kotlin/DeprecatedKotlin.kt - |package kotlin + |package deprecated | |/** | * Average function description @@ -156,7 +156,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { ) { pagesTransformationStage = { module -> val functionWithDeprecatedFunction = module.children - .single { it.name == "kotlin" }.children + .single { it.name == "deprecated" }.children .single { it.name == "oldLegacyFunction" } as ContentPage functionWithDeprecatedFunction.content.assertNode { @@ -217,7 +217,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { testInline( """ |/src/main/kotlin/kotlin/DeprecatedKotlin.kt - |package kotlin + |package deprecated | |/** | * Average function description @@ -240,7 +240,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { ) { pagesTransformationStage = { module -> val functionWithDeprecatedFunction = module.children - .single { it.name == "kotlin" }.children + .single { it.name == "deprecated" }.children .single { it.name == "oldLegacyFunction" } as ContentPage functionWithDeprecatedFunction.content.assertNode { @@ -298,7 +298,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { testInline( """ |/src/main/kotlin/kotlin/DeprecatedKotlin.kt - |package kotlin + |package deprecated | |/** | * Average function description @@ -330,7 +330,7 @@ class KotlinDeprecatedTest : BaseAbstractTest() { ) { pagesTransformationStage = { module -> val functionWithDeprecatedFunction = module.children - .single { it.name == "kotlin" }.children + .single { it.name == "deprecated" }.children .single { it.name == "oldLegacyFunction" } as ContentPage functionWithDeprecatedFunction.content.assertNode { diff --git a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt index de7c4e43..f4ef85b9 100644 --- a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt +++ b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt @@ -130,6 +130,8 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { } } } + + // Unreal case: Upper bound of a type parameter cannot be an array @Test fun `generic fun and class`() { testInline( @@ -138,7 +140,7 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { |package example | |fun<T : Array<Int>> testFunction() { } - |class<T : Array<Int>> myTestClass{ } + |class myTestClass<T : Array<Int>>{ } | | """.trimMargin(), diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt index 1583e0c9..807ede78 100644 --- a/plugins/base/src/test/kotlin/model/ClassesTest.kt +++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt @@ -550,11 +550,12 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class | value class InlineTest(val x: String) """.trimMargin() ) { - val classlike = packages.flatMap { it.classlikes }.first() as DClass - classlike.name equals "X" - classlike.properties.first().name equals "example" - classlike.extra[AdditionalModifiers]?.content?.values?.firstOrNull() - ?.firstOrNull() equals ExtraModifiers.KotlinOnlyModifiers.Inline + with((this / "classes" / "X").cast<DClass>()) { + name equals "X" + properties.first().name equals "example" + extra[AdditionalModifiers]?.content?.values?.firstOrNull() + ?.firstOrNull() equals ExtraModifiers.KotlinOnlyModifiers.Inline + } } } diff --git a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt index 3a440af0..57165fd1 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt @@ -190,7 +190,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, ) assertEquals( testSuite.additionalModifiers, - extra[AdditionalModifiers]?.content?.values?.single(), + extra[AdditionalModifiers]?.content?.values?.single() ?: emptySet<ExtraModifiers>(), "Test for class ${classlike.name} with property $name failed" ) } @@ -213,7 +213,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs, ) assertEquals( testSuite.additionalModifiers, - extra[AdditionalModifiers]?.content?.values?.single(), + extra[AdditionalModifiers]?.content?.values?.single() ?: emptySet<ExtraModifiers>(), "Test for class ${classlike.name} with function $name failed" ) } |