diff options
Diffstat (limited to 'plugins/base/src/test')
21 files changed, 105 insertions, 166 deletions
diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt index 57e05858..3a4ff84d 100644 --- a/plugins/base/src/test/kotlin/basic/DRITest.kt +++ b/plugins/base/src/test/kotlin/basic/DRITest.kt @@ -190,7 +190,7 @@ class DRITest : BaseAbstractTest() { ) { pagesGenerationStage = { module -> val sampleClass = module.dfs { it.name == "Sample" } as ClasslikePageNode - val classDocumentable = sampleClass.documentable as DClass + val classDocumentable = sampleClass.documentables.firstOrNull() as DClass assertEquals( "example/Sample///PointingToDeclaration/", sampleClass.dri.first().toString()) assertEquals("example/Sample///PointingToGenericParameters(0)/", classDocumentable.generics.first().dri.toString()) @@ -224,7 +224,7 @@ class DRITest : BaseAbstractTest() { pagesGenerationStage = { module -> val sampleClass = module.dfs { it.name == "Sample" } as ClasslikePageNode val functionNode = sampleClass.children.first { it.name == "genericFun" } as MemberPageNode - val functionDocumentable = functionNode.documentable as DFunction + val functionDocumentable = functionNode.documentables.firstOrNull() as DFunction val parameter = functionDocumentable.parameters.first() assertEquals("example/Sample/genericFun/#kotlin.String/PointingToDeclaration/", functionNode.dri.first().toString()) @@ -269,9 +269,10 @@ class DRITest : BaseAbstractTest() { val sampleClass = module.dfs { it.name == "Sample" } as ClasslikePageNode val sampleInner = sampleClass.children.first { it.name == "SampleInner" } as ClasslikePageNode val foo = sampleInner.children.first { it.name == "foo" } as MemberPageNode - val documentable = foo.documentable as DFunction + val documentable = foo.documentables.firstOrNull() as DFunction - assertEquals((sampleClass.documentable as WithGenerics).generics.first().dri.toString(), (documentable.type as TypeParameter).dri.toString()) + val generics = (sampleClass.documentables.firstOrNull() as WithGenerics).generics + assertEquals(generics.first().dri.toString(), (documentable.type as TypeParameter).dri.toString()) assertEquals(0, documentable.generics.size) } } @@ -298,7 +299,7 @@ class DRITest : BaseAbstractTest() { ) { pagesGenerationStage = { module -> val extensionFunction = module.dfs { it.name == "extensionFunction" } as MemberPageNode - val documentable = extensionFunction.documentable as DFunction + val documentable = extensionFunction.documentables.firstOrNull() as DFunction assertEquals( "example//extensionFunction/kotlin.collections.List[TypeParam(bounds=[kotlin.Any?])]#/PointingToDeclaration/", diff --git a/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt b/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt index b44eb651..e5533a7e 100644 --- a/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt +++ b/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt @@ -1,9 +1,9 @@ package content -import junit.framework.Assert.assertEquals import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.doc.* import org.junit.jupiter.api.Test +import kotlin.test.assertEquals import kotlin.test.assertTrue class ContentInDescriptionTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt index 664b8282..50580afc 100644 --- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt +++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt @@ -1412,7 +1412,7 @@ class ContentForParamsTest : BaseAbstractTest() { it is MemberPageNode && it.dri.first() .toString() == "test/Main/sample/#java.lang.String#java.lang.String/PointingToDeclaration/" } as MemberPageNode - val forJvm = (sampleFunction.documentable as DFunction).parameters.mapNotNull { + val forJvm = (sampleFunction.documentables.firstOrNull() as DFunction).parameters.mapNotNull { val jvm = it.documentation.keys.first { it.analysisPlatform == Platform.jvm } it.documentation[jvm] } diff --git a/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt b/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt index 5bd152dc..164fa62d 100644 --- a/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt +++ b/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt @@ -24,7 +24,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { propertyTest { rootPage -> val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocsForPlaceholdersEnabled = - (node.documentable as DClass).constructors.first().parameters.find { it.name == "placeholdersEnabled" } + (node.documentables.firstOrNull() as DClass).constructors.first().parameters.find { it.name == "placeholdersEnabled" } ?.documentation?.entries?.first()?.value assertEquals(DocumentationNode(listOf(docsForPlaceholdersEnabled)), actualDocsForPlaceholdersEnabled) } @@ -35,7 +35,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { propertyTest { rootPage -> val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocsForRequestedLoadSize = - (node.documentable as DClass).constructors.first().parameters.find { it.name == "requestedLoadSize" } + (node.documentables.firstOrNull() as DClass).constructors.first().parameters.find { it.name == "requestedLoadSize" } ?.documentation?.entries?.first()?.value assertEquals(DocumentationNode(listOf(docsForRequestedLoadSize)), actualDocsForRequestedLoadSize) } @@ -47,7 +47,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocsForRequestedInitialKey = - (node.documentable as DClass).constructors.first().parameters.find { it.name == "requestedInitialKey" } + (node.documentables.firstOrNull() as DClass).constructors.first().parameters.find { it.name == "requestedInitialKey" } ?.documentation?.entries?.first()?.value assertEquals(DocumentationNode(listOf(docsForRequestedInitialKey)), actualDocsForRequestedInitialKey) } @@ -71,7 +71,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocs = - (node.documentable as DClass).constructors.first().documentation.entries.first().value + (node.documentables.firstOrNull() as DClass).constructors.first().documentation.entries.first().value assertEquals(DocumentationNode(listOf(constructorDocs, docsForParam)), actualDocs) } } @@ -94,7 +94,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocs = - (node.documentable as DClass).documentation.entries.first().value + (node.documentables.firstOrNull() as DClass).documentation.entries.first().value assertEquals( DocumentationNode( listOf( @@ -129,7 +129,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "ItemKeyedDataSource" } as ClasslikePageNode val actualDocs = - (node.documentable as DClass).properties.first().documentation.entries.first().value + (node.documentables.firstOrNull() as DClass).properties.first().documentation.entries.first().value assertEquals( DocumentationNode(listOf(ownDescription)), actualDocs diff --git a/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt b/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt index e566320c..d7399914 100644 --- a/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt +++ b/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt @@ -1,7 +1,5 @@ package content.receiver -import junit.framework.Assert.assertEquals -import junit.framework.Assert.assertNotNull import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.doc.Receiver @@ -11,6 +9,8 @@ import org.jetbrains.dokka.pages.ContentText import org.jetbrains.dokka.pages.MemberPageNode import org.junit.jupiter.api.Test import utils.docs +import kotlin.test.assertEquals +import kotlin.test.assertNotNull class ContentForReceiverTest: BaseAbstractTest() { private val testConfiguration = dokkaConfiguration { @@ -40,7 +40,7 @@ class ContentForReceiverTest: BaseAbstractTest() { with(module.packages.flatMap { it.functions }.first()){ val receiver = docs().firstOrNull { it is Receiver } assertNotNull(receiver) - val content = receiver?.dfs { it is Text } as Text + val content = receiver.dfs { it is Text } as Text assertEquals("docs for string", content.body) } } diff --git a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt index d1b8153d..1d86f219 100644 --- a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt +++ b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt @@ -52,7 +52,7 @@ abstract class AbstractExpectTest( excludes: List<String>, timeout: Long = 500 ) { - obtained?.let { path -> + obtained?.let { _ -> val (res, out, err) = runDiff(expected, obtained, excludes, timeout) assertTrue(res == 0, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}") } ?: throw AssertionError("obtained path is null") diff --git a/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt b/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt index e7c45abd..13d4b456 100644 --- a/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt +++ b/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt @@ -43,42 +43,42 @@ class ExpectActualsTest : BaseAbstractTest() { sourceRoots = listOf("src/commonN2Main/kotlin/pageMerger/Test.kt") dependentSourceSets = setOf(common.value.sourceSetID) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" dependentSourceSets = setOf(commonJ.value.sourceSetID) sourceRoots = listOf("src/jsMain/kotlin/pageMerger/Test.kt") } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" dependentSourceSets = setOf(commonJ.value.sourceSetID) sourceRoots = listOf("src/jvmMain/kotlin/pageMerger/Test.kt") } - val linuxX64 = sourceSet { + sourceSet { name = "linuxX64" displayName = "linuxX64" analysisPlatform = "native" dependentSourceSets = setOf(commonN1.value.sourceSetID) sourceRoots = listOf("src/linuxX64Main/kotlin/pageMerger/Test.kt") } - val mingwX64 = sourceSet { + sourceSet { name = "mingwX64" displayName = "mingwX64" analysisPlatform = "native" dependentSourceSets = setOf(commonN1.value.sourceSetID) sourceRoots = listOf("src/mingwX64Main/kotlin/pageMerger/Test.kt") } - val iosArm64 = sourceSet { + sourceSet { name = "iosArm64" displayName = "iosArm64" analysisPlatform = "native" dependentSourceSets = setOf(commonN2.value.sourceSetID) sourceRoots = listOf("src/iosArm64Main/kotlin/pageMerger/Test.kt") } - val iosX64 = sourceSet { + sourceSet { name = "iosX64" displayName = "iosX64" analysisPlatform = "native" @@ -149,19 +149,19 @@ class ExpectActualsTest : BaseAbstractTest() { val noClass = allChildren.filter { it.name == "A" } assertTrue(commonJ.size == 1) { "There can be only one [jvm, js]A page" } assertTrue( - commonJ.first().documentable?.sourceSets?.map { it.displayName } + commonJ.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } ?.containsAll(listOf("commonJ", "js", "jvm")) ?: false ) { "A(jvm, js)should have commonJ, js, jvm sources" } assertTrue(commonN1.size == 1) { "There can be only one [mingwX64, linuxX64]A page" } assertTrue( - commonN1.first().documentable?.sourceSets?.map { it.displayName } + commonN1.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } ?.containsAll(listOf("commonN1", "linuxX64", "mingwX64")) ?: false ) { "[mingwX64, linuxX64]A should have commonN1, linuxX64, mingwX64 sources" } assertTrue(commonN2.size == 1) { "There can be only one [iosX64, iosArm64]A page" } assertTrue( - commonN2.first().documentable?.sourceSets?.map { it.displayName } + commonN2.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } ?.containsAll(listOf("commonN2", "iosArm64", "iosX64")) ?: false ) { "[iosX64, iosArm64]A should have commonN2, iosArm64, iosX64 sources" } diff --git a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt index e6acec92..efab9aba 100644 --- a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt @@ -225,6 +225,7 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { ) companion object TestDataSources { + @Suppress("DEPRECATION") // for includeNonPublic val globalExcludes = dokkaConfiguration { sourceSets { sourceSet { @@ -234,6 +235,7 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { } } + @Suppress("DEPRECATION") // for includeNonPublic val globalIncludes = dokkaConfiguration { sourceSets { sourceSet { @@ -243,6 +245,7 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { } } + @Suppress("DEPRECATION") // for includeNonPublic val globalIncludesPackageExcludes = dokkaConfiguration { sourceSets { sourceSet { @@ -251,17 +254,18 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { perPackageOptions = mutableListOf( PackageOptionsImpl( "basic", - false, - false, - false, - false, - DokkaDefaults.documentedVisibilities + includeNonPublic = false, + reportUndocumented = false, + skipDeprecated = false, + suppress = false, + documentedVisibilities = DokkaDefaults.documentedVisibilities ) ) } } } + @Suppress("DEPRECATION") // for includeNonPublic val globalExcludesPackageIncludes = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt index 3b333445..c89234f8 100644 --- a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt @@ -372,6 +372,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `should choose new documentedVisibilities over deprecated includeNonPublic`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -404,6 +405,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - public function with false global`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -435,6 +437,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with false global`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -466,6 +469,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with true global`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -497,6 +501,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `private setter with false global includeNonPublic`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -528,6 +533,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with false global true package`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -569,6 +575,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with true global false package`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -610,6 +617,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private typealias should be skipped`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -636,6 +644,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - internal property from enum should be skipped`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -675,6 +684,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - internal property from enum`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index 3b0f6eef..1a4bb330 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -39,7 +39,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -47,7 +47,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) includes = listOf(Paths.get("$includesDir/include2.md").toString()) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -91,7 +91,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -105,7 +105,7 @@ class LinkableContentTest : BaseAbstractTest() { ) ) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -165,7 +165,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -173,7 +173,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) samples = listOf("$testDataDir/jsMain/resources/Samples.kt") } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -192,9 +192,9 @@ class LinkableContentTest : BaseAbstractTest() { Assertions.assertEquals(1, moduleChildren.size) val packageChildren = moduleChildren.first().children Assertions.assertEquals(2, packageChildren.size) - packageChildren.forEach { - val name = it.name.substringBefore("Class") - val classChildren = it.children + packageChildren.forEach { pageNode -> + val name = pageNode.name.substringBefore("Class") + val classChildren = pageNode.children Assertions.assertEquals(2, classChildren.size) val function = classChildren.find { it.name == "printWithExclamation" } val text = function.cast<MemberPageNode>().content.cast<ContentGroup>().children.last() @@ -256,7 +256,7 @@ class LinkableContentTest : BaseAbstractTest() { }?.safeAs<ContentDRILink>() Assertions.assertEquals( - (sample.documentable as WithGenerics).generics.first().dri, + (sample.documentables.firstOrNull() as WithGenerics).generics.first().dri, returnTypeNode?.address ) } @@ -323,7 +323,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -331,7 +331,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) includes = listOf(Paths.get("$includesDir/include2.md").toString()) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -346,8 +346,8 @@ class LinkableContentTest : BaseAbstractTest() { } testFromData(configuration) { - documentablesMergingStage = { - it.documentation.entries.single { + documentablesMergingStage = { module -> + module.documentation.entries.single { it.key.displayName == "jvm" }.value.run { Assertions.assertNotNull(dfs { diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt index ac8efe6a..fddd41e7 100644 --- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt +++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt @@ -26,7 +26,7 @@ abstract class KDocTest : BaseAbstractTest() { """.trimMargin() private fun actualDocumentationNode(modulePageNode: ModulePageNode) = - (modulePageNode.documentable?.children?.first() as DPackage) + (modulePageNode.documentables.firstOrNull()?.children?.first() as DPackage) .classlikes.single() .documentation.values.single() diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt index 186fe9ee..f141bb06 100644 --- a/plugins/base/src/test/kotlin/markdown/LinkTest.kt +++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt @@ -74,7 +74,7 @@ class LinkTest : BaseAbstractTest() { val root = rootPageNode.children.single().children.single() as ClasslikePageNode val innerClass = root.children.first { it is ClasslikePageNode } val foo = innerClass.children.first { it.name == "foo" } as MemberPageNode - val destinationDri = (root.documentable as WithGenerics).generics.first().dri.toString() + val destinationDri = (root.documentables.firstOrNull() as WithGenerics).generics.first().dri.toString() assertEquals(destinationDri, "/Outer///PointingToGenericParameters(0)/") assertNotNull(foo.content.dfs { it is ContentDRILink && it.address.toString() == destinationDri }) diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt index 59b1817a..6a7b2d89 100644 --- a/plugins/base/src/test/kotlin/model/CommentTest.kt +++ b/plugins/base/src/test/kotlin/model/CommentTest.kt @@ -72,7 +72,6 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |fun tst() = property """ ) { - val p = this with((this / "comment" / "property").cast<DProperty>()) { comments() equals "" } @@ -252,85 +251,4 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme } } } - -// @Test todo - fun directive() { - inlineModelTest( - """ - |/** - | * Summary - | * - | * @sample example1 - | * @sample example2 - | * @sample X.example3 - | * @sample X.Y.example4 - | */ - |val property = "test" - | - |fun example1(node: String) = if (true) { - | println(property) - |} - | - |fun example2(node: String) { - | if (true) { - | println(property) - | } - |} - | - |class X { - | fun example3(node: String) { - | if (true) { - | println(property) - | } - | } - | - | class Y { - | fun example4(node: String) { - | if (true) { - | println(property) - | } - | } - | } - |} - """ - ) { - with((this / "comment" / "property").cast<DProperty>()) { - this - } - } - } - - -// @Test fun directive() { -// checkSourceExistsAndVerifyModel("testdata/comments/directive.kt", defaultModelConfig) { model -> -// with(model.members.single().members.first()) { -// assertEquals("Summary", content.summary.toTestString()) -// with (content.description) { -// assertEqualsIgnoringSeparators(""" -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |""".trimMargin(), toTestString()) -// } -// } -// } -// } - } diff --git a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt index 4b410f33..46b13763 100644 --- a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt +++ b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt @@ -137,14 +137,14 @@ class PageNodeMergerTest : BaseAbstractTest() { analysisPlatform = "common" sourceRoots = listOf("src/commonMain/kotlin/pageMerger/Test.kt") } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf("src/jsMain/kotlin/pageMerger/Test.kt") } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -178,10 +178,10 @@ class PageNodeMergerTest : BaseAbstractTest() { val jsClass = allChildren.filter { it.name == "[js]DoNotMerge" } val noClass = allChildren.filter { it.name == "DoNotMerge" } assertTrue(jvmClass.size == 1) { "There can be only one DoNotMerge(jvm) page" } - assertTrue(jvmClass.first().documentable?.sourceSets?.single()?.analysisPlatform?.key == "jvm") { "[jvm]DoNotMerge should have only jvm sources" } + assertTrue(jvmClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "jvm") { "[jvm]DoNotMerge should have only jvm sources" } assertTrue(jsClass.size == 1) { "There can be only one DoNotMerge(js) page" } - assertTrue(jsClass.first().documentable?.sourceSets?.single()?.analysisPlatform?.key == "js") { "[js]DoNotMerge should have only js sources" } + assertTrue(jsClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "js") { "[js]DoNotMerge should have only js sources" } assertTrue(noClass.isEmpty()) { "There can't be any DoNotMerge page" } } diff --git a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt index c77a78fb..3e5ceb75 100644 --- a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt @@ -1,11 +1,11 @@ package renderers.html -import junit.framework.Assert.assertEquals import kotlinx.html.body import kotlinx.html.html import kotlinx.html.stream.createHTML import org.jetbrains.dokka.base.renderers.html.buildBreakableText import org.junit.jupiter.api.Test +import kotlin.test.assertEquals class FormattingUtilsTest { @Test diff --git a/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt b/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt index 8a8586ee..989b82ef 100644 --- a/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt +++ b/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt @@ -63,7 +63,7 @@ class ResourceLinksTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(TestResourcesAppenderPlugin(absoluteResources + relativeResources), writerPlugin) ) { - renderingStage = { root, context -> + renderingStage = { _, _ -> Jsoup .parse(writerPlugin.writer.contents.getValue("root/example.html")) .head() @@ -114,7 +114,7 @@ class ResourceLinksTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(writerPlugin) ) { - renderingStage = { root, context -> + renderingStage = { _, _ -> run { if (isMultiModule) { assertNull(writerPlugin.writer.contents["images/customImage.svg"]) @@ -179,7 +179,7 @@ class ResourceLinksTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(TestResourcesAppenderPlugin(absoluteResources + relativeResources), writerPlugin) ) { - renderingStage = { root, context -> + renderingStage = { _, _ -> run { assertNull(writerPlugin.writer.contents["scripts/relativePath.js"]) assertNull(writerPlugin.writer.contents["styles/relativePath.js"]) diff --git a/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt b/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt index 65ac1224..e7f408f2 100644 --- a/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt +++ b/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt @@ -27,14 +27,14 @@ abstract class AbstractRenderingTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" dependentSourceSets = setOf(common.value.sourceSetID, jvmAndJsSecondCommonMain.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" diff --git a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt index ad3b5d38..33ec2372 100644 --- a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt +++ b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt @@ -134,10 +134,10 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() { assertNotNull(classPage, "Tested class not found!") val props = classPage.findSectionWithName("Properties").assertNotNull("Properties") - val prop1 = props.children.singleOrNull().assertNotNull("prop1") + props.children.singleOrNull().assertNotNull("prop1") val functions = classPage.findSectionWithName("Functions").assertNotNull("Functions") - val method1 = functions.children.singleOrNull().assertNotNull("method1") + functions.children.singleOrNull().assertNotNull("method1") } } } @@ -218,7 +218,7 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() { assertNotNull(classPage, "Tested class not found!") val entries = classPage.findSectionWithName("Entries").assertNotNull("Entries") - val entry = entries.children.singleOrNull().assertNotNull("ENTRY") + entries.children.singleOrNull().assertNotNull("ENTRY") val props = classPage.findSectionWithName("Properties").assertNotNull("Properties") assertEquals( diff --git a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt index fd9fcc5d..79e9f548 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt @@ -185,48 +185,50 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { classlikes.zip(testSuites).forEach { (classlike, testSuites) -> testSuites.forEach { testSuite -> when (testSuite) { - is TestSuite.PropertyDoesntExist -> Assert.assertEquals( - "Test for class ${classlike.name} failed", + is TestSuite.PropertyDoesntExist -> assertEquals( null, - classlike.properties.firstOrNull { it.name == testSuite.propertyName }) + classlike.properties.firstOrNull { it.name == testSuite.propertyName }, + "Test for class ${classlike.name} failed" + ) is TestSuite.PropertyExists -> classlike.properties.single { it.name == testSuite.propertyName } .run { - Assert.assertEquals( - "Test for class ${classlike.name} with property $name failed", + assertEquals( testSuite.modifier, - modifier.values.single() + modifier.values.single(), + "Test for class ${classlike.name} with property $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with property $name failed", + assertEquals( testSuite.visibility, - visibility.values.single() + visibility.values.single(), + "Test for class ${classlike.name} with property $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with property $name failed", + assertEquals( testSuite.additionalModifiers, - extra[AdditionalModifiers]?.content?.values?.single() + extra[AdditionalModifiers]?.content?.values?.single(), + "Test for class ${classlike.name} with property $name failed" ) } - is TestSuite.FunctionDoesntExist -> Assert.assertEquals( - "Test for class ${classlike.name} failed", + is TestSuite.FunctionDoesntExist -> assertEquals( null, - classlike.functions.firstOrNull { it.name == testSuite.propertyName }) + classlike.functions.firstOrNull { it.name == testSuite.propertyName }, + "Test for class ${classlike.name} failed" + ) is TestSuite.FunctionExists -> classlike.functions.single { it.name == testSuite.propertyName } .run { - Assert.assertEquals( - "Test for class ${classlike.name} with function $name failed", + assertEquals( testSuite.modifier, - modifier.values.single() + modifier.values.single(), + "Test for class ${classlike.name} with function $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with function $name failed", + assertEquals( testSuite.visibility, - visibility.values.single() + visibility.values.single(), + "Test for class ${classlike.name} with function $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with function $name failed", + assertEquals( testSuite.additionalModifiers, - extra[AdditionalModifiers]?.content?.values?.single() + extra[AdditionalModifiers]?.content?.values?.single(), + "Test for class ${classlike.name} with function $name failed" ) } } @@ -481,6 +483,7 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { @Test fun `derived properties with only public code`() { + @Suppress("DEPRECATION") // for includeNonPublic val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -666,6 +669,7 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { } } + @Suppress("DEPRECATION") // for includeNonPublic val javaConfiguration = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt index 9f74e219..1213727d 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt @@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test import utils.assertNotNull class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { + @Suppress("DEPRECATION") // for includeNonPublic val configuration = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt index ecde2c77..7510e541 100644 --- a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt +++ b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt @@ -12,6 +12,7 @@ import org.jetbrains.dokka.model.doc.Deprecated as DokkaDeprecatedTag import org.jetbrains.dokka.model.doc.Throws as DokkaThrowsTag class JavadocInheritedDocTagsTest : BaseAbstractTest() { + @Suppress("DEPRECATION") // for includeNonPublic private val configuration = dokkaConfiguration { sourceSets { sourceSet { |