aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt515
1 files changed, 0 insertions, 515 deletions
diff --git a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
deleted file mode 100644
index 8af9e082..00000000
--- a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package content.signatures
-
-import matchers.content.*
-import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.jetbrains.dokka.pages.ContentPage
-import org.jetbrains.dokka.pages.PackagePageNode
-import utils.ParamAttributes
-import utils.bareSignature
-import utils.propertySignature
-import utils.typealiasSignature
-import kotlin.test.Test
-
-class ContentForSignaturesTest : BaseAbstractTest() {
-
- private val testConfiguration = dokkaConfiguration {
- sourceSets {
- sourceSet {
- sourceRoots = listOf("src/")
- analysisPlatform = "jvm"
- documentedVisibilities = setOf(
- DokkaConfiguration.Visibility.PUBLIC,
- DokkaConfiguration.Visibility.PRIVATE,
- DokkaConfiguration.Visibility.PROTECTED,
- DokkaConfiguration.Visibility.INTERNAL,
- )
- }
- }
- }
-
- @Test
- fun `function`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |fun function(abc: String): String {
- | return "Hello, " + abc
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- emptyMap(),
- "",
- "",
- emptySet(),
- "function",
- "String",
- "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
- )
- }
- }
- }
- }
- }
- }
- }
-
- @Test
- fun `private function`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |private fun function(abc: String): String {
- | return "Hello, " + abc
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- emptyMap(),
- "private",
- "",
- emptySet(),
- "function",
- "String",
- "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
- )
- }
- }
- }
- }
- }
- }
- }
-
- @Test
- fun `open function`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |open fun function(abc: String): String {
- | return "Hello, " + abc
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- emptyMap(),
- "",
- "open",
- emptySet(),
- "function",
- "String",
- "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
- )
- }
- }
- }
- }
- }
- }
- }
-
- @Test
- fun `function without parameters`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |fun function(): String {
- | return "Hello"
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- annotations = emptyMap(),
- visibility = "",
- modifier = "",
- keywords = emptySet(),
- name = "function",
- returnType = "String",
- )
- }
- }
- }
-
- }
- }
- }
- }
-
-
- @Test
- fun `suspend function`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |suspend fun function(abc: String): String {
- | return "Hello, " + abc
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- emptyMap(),
- "",
- "",
- setOf("suspend"),
- "function",
- "String",
- "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
- )
- }
- }
- }
- }
- }
- }
- }
-
- @Test
- fun `protected open suspend function`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |protected open suspend fun function(abc: String): String {
- | return "Hello, " + abc
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- emptyMap(),
- "protected",
- "open",
- setOf("suspend"),
- "function",
- "String",
- "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
- )
- }
- }
- }
- }
- }
- }
- }
-
- @Test
- fun `protected open suspend inline function`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |protected open suspend inline fun function(abc: String): String {
- | return "Hello, " + abc
- |}
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" }
- .children.single { it.name == "function" } as ContentPage
- page.content.assertNode {
- group {
- header(1) { +"function" }
- }
- divergentGroup {
- divergentInstance {
- divergent {
- bareSignature(
- emptyMap(),
- "protected",
- "open",
- setOf("inline", "suspend"),
- "function",
- "String",
- "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
- )
- }
- }
- }
- }
- }
- }
- }
-
- @Test
- fun `property`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |val property: Int = 6
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- propertySignature(emptyMap(), "", "", emptySet(), "val", "property", "Int", "6")
- }
- }
- }
- }
-
- @Test
- fun `const property`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |const val property: Int = 6
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- propertySignature(emptyMap(), "", "", setOf("const"), "val", "property", "Int", "6")
- }
- }
- }
- }
-
- @Test
- fun `protected property`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |protected val property: Int = 6
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- propertySignature(emptyMap(), "protected", "", emptySet(), "val", "property", "Int", "6")
- }
- }
- }
- }
-
- @Test
- fun `protected lateinit property`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |protected lateinit var property: Int = 6
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- propertySignature(emptyMap(), "protected", "", setOf("lateinit"), "var", "property", "Int", null)
- }
- }
- }
- }
-
- @Test
- fun `should not display default value for mutable property`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |var property: Int = 6
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- propertySignature(
- annotations = emptyMap(),
- visibility = "",
- modifier = "",
- keywords = setOf(),
- preposition = "var",
- name = "property",
- type = "Int",
- value = null
- )
- }
- }
- }
- }
-
- @Test
- fun `typealias to String`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |typealias Alias = String
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- typealiasSignature("Alias", "String")
- }
- }
- }
- }
-
- @Test
- fun `typealias to Int`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |typealias Alias = Int
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- typealiasSignature("Alias", "Int")
- }
- }
- }
- }
-
- @Test
- fun `typealias to type in same package`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |
- |typealias Alias = X
- |class X
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- typealiasSignature("Alias", "X")
- }
- }
- }
- }
-
- @Test
- fun `typealias to type in different package`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |import other.X
- |typealias Alias = X
- |
- |/src/main/kotlin/test/source2.kt
- |package other
- |class X
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- typealiasSignature("Alias", "X")
- }
- }
- }
- }
-
- @Test
- fun `typealias to type in different package with same name`() {
- testInline(
- """
- |/src/main/kotlin/test/source.kt
- |package test
- |typealias Alias = other.Alias
- |
- |/src/main/kotlin/test/source2.kt
- |package other
- |class Alias
- """.trimIndent(), testConfiguration
- ) {
- pagesTransformationStage = { module ->
- val page = module.children.single { it.name == "test" } as PackagePageNode
- page.content.assertNode {
- typealiasSignature("Alias", "other.Alias")
- }
- }
- }
- }
-}