aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.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/transformers/DivisionSwitchTest.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/transformers/DivisionSwitchTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt126
1 files changed, 0 insertions, 126 deletions
diff --git a/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt b/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt
deleted file mode 100644
index fec5fc47..00000000
--- a/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package transformers
-
-import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.PluginConfigurationImpl
-import org.jetbrains.dokka.base.DokkaBase
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.jetbrains.dokka.model.dfs
-import org.jetbrains.dokka.pages.ClasslikePageNode
-import org.jetbrains.dokka.pages.ContentHeader
-import org.jetbrains.dokka.pages.ContentNode
-import org.jetbrains.dokka.pages.ContentText
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-
-class DivisionSwitchTest : BaseAbstractTest() {
-
- private val query = """
- |/src/source0.kt
- package package0
- /**
- * Documentation for ClassA
- */
- class ClassA {
- val A: String = "A"
- fun a() {}
- fun b() {}
- }
-
- /src/source1.kt
- package package0
- /**
- * Documentation for ClassB
- */
- class ClassB : ClassA() {
- val B: String = "B"
- fun d() {}
- fun e() {}
- }
- """.trimMargin()
-
- private fun configuration(switchOn: Boolean) = dokkaConfiguration {
- sourceSets {
- sourceSet {
- sourceRoots = listOf("src/")
- }
- }
- suppressObviousFunctions = false
- pluginsConfigurations.add(
- PluginConfigurationImpl(
- DokkaBase::class.qualifiedName!!,
- DokkaConfiguration.SerializationFormat.JSON,
- """{ "separateInheritedMembers": $switchOn }""",
- )
- )
- }
-
- private fun testClassB(switchOn: Boolean, operation: (ClasslikePageNode) -> Unit) {
- testInline(
- query,
- configuration(switchOn),
- cleanupOutput = true
- ) {
- pagesTransformationStage = { root ->
- val classB = root.dfs { it.name == "ClassB" } as? ClasslikePageNode
- assertNotNull(classB, "Tested class not found!")
- operation(classB)
- }
- }
- }
-
- private fun ClasslikePageNode.findSectionWithName(name: String) : ContentNode? {
- var sectionHeader: ContentHeader? = null
- return content.dfs { node ->
- node.children.filterIsInstance<ContentHeader>().any { header ->
- header.children.firstOrNull { it is ContentText && it.text == name }?.also { sectionHeader = header } != null
- }
- }?.children?.dropWhile { child -> child != sectionHeader }?.drop(1)?.firstOrNull()
- }
-
- @Test
- fun `should not split inherited and regular methods`() {
- testClassB(false) { classB ->
- val functions = classB.findSectionWithName("Functions")
- assertNotNull(functions, "Functions not found!")
- assertEquals(7, functions.children.size, "Incorrect number of functions found")
- }
- }
-
- @Test
- fun `should not split inherited and regular properties`() {
- testClassB(false) { classB ->
- val properties = classB.findSectionWithName("Properties")
- assertNotNull(properties, "Properties not found!")
- assertEquals(2, properties.children.size, "Incorrect number of properties found")
- }
- }
-
- @Test
- fun `should split inherited and regular methods`() {
- testClassB(true) { classB ->
- val functions = classB.findSectionWithName("Functions")
- val inheritedFunctions = classB.findSectionWithName("Inherited functions")
- assertNotNull(functions, "Functions not found!")
- assertEquals(2, functions.children.size, "Incorrect number of functions found")
- assertNotNull(inheritedFunctions, "Inherited functions not found!")
- assertEquals(5, inheritedFunctions.children.size, "Incorrect number of inherited functions found")
- }
- }
-
- @Test
- fun `should split inherited and regular properties`() {
- testClassB(true) { classB ->
- val properties = classB.findSectionWithName("Properties")
- assertNotNull(properties, "Properties not found!")
- assertEquals(1, properties.children.size, "Incorrect number of properties found")
- val inheritedProperties = classB.findSectionWithName("Inherited properties")
- assertNotNull(inheritedProperties, "Inherited properties not found!")
- assertEquals(1, inheritedProperties.children.size, "Incorrect number of inherited properties found")
- }
- }
-}