aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/transformers
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-28 18:24:11 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-31 15:10:04 +0200
commit8bae1b84fabce1eae68a6bd9464c5a13a03b36d4 (patch)
treeec222e6375f7282566b4770ae06fce76b529c174 /plugins/base/src/test/kotlin/transformers
parentc75185e229c7e8bf8e2d894d08d1d0159cd60094 (diff)
downloaddokka-8bae1b84fabce1eae68a6bd9464c5a13a03b36d4.tar.gz
dokka-8bae1b84fabce1eae68a6bd9464c5a13a03b36d4.tar.bz2
dokka-8bae1b84fabce1eae68a6bd9464c5a13a03b36d4.zip
Implement dPackage and dModule test APIs in favour of default params in DModule and DPackage
Diffstat (limited to 'plugins/base/src/test/kotlin/transformers')
-rw-r--r--plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt24
-rw-r--r--plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt3
-rw-r--r--plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt13
3 files changed, 21 insertions, 19 deletions
diff --git a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt
index 51a5e85a..2aba6d67 100644
--- a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt
+++ b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt
@@ -3,8 +3,6 @@ package transformers
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.transformers.documentables.ModuleAndPackageDocumentationReader
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.DModule
-import org.jetbrains.dokka.model.DPackage
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.testApi.logger.TestLogger
@@ -13,6 +11,8 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import testApi.testRunner.TestDokkaConfigurationBuilder
+import testApi.testRunner.dModule
+import testApi.testRunner.dPackage
class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAndPackageDocumentationReaderTest() {
@@ -83,7 +83,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert moduleA with sourceSetA`() {
- val documentation = reader[DModule(name = "moduleA", sourceSets = setOf(sourceSetA))]
+ val documentation = reader[dModule(name = "moduleA", sourceSets = setOf(sourceSetA))]
assertEquals(
1, documentation.keys.size,
"Expected moduleA only containing documentation in a single source set"
@@ -101,7 +101,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert moduleA with no source sets`() {
- val documentation = reader[DModule("moduleA")]
+ val documentation = reader[dModule("moduleA")]
assertEquals(
emptyMap<DokkaSourceSet, DocumentationNode>(), documentation,
"Expected no documentation received for module not declaring a matching sourceSet"
@@ -111,7 +111,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert moduleA with unknown source set`() {
val documentation = reader[
- DModule("moduleA", sourceSets = setOf(configurationBuilder.unattachedSourceSet { name = "unknown" }))
+ dModule("moduleA", sourceSets = setOf(configurationBuilder.unattachedSourceSet { name = "unknown" }))
]
assertEquals(
emptyMap<DokkaSourceSet, DocumentationNode>(), documentation,
@@ -121,7 +121,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert moduleA with all sourceSets`() {
- val documentation = reader[DModule("moduleA", sourceSets = setOf(sourceSetA, sourceSetB, sourceSetB2))]
+ val documentation = reader[dModule("moduleA", sourceSets = setOf(sourceSetA, sourceSetB, sourceSetB2))]
assertEquals(1, documentation.entries.size, "Expected only one entry from sourceSetA")
assertEquals(sourceSetA, documentation.keys.single(), "Expected only one entry from sourceSetA")
assertEquals("This is moduleA", documentation.texts.single())
@@ -129,7 +129,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert moduleB with sourceSetB and sourceSetB2`() {
- val documentation = reader[DModule("moduleB", sourceSets = setOf(sourceSetB, sourceSetB2))]
+ val documentation = reader[dModule("moduleB", sourceSets = setOf(sourceSetB, sourceSetB2))]
assertEquals(1, documentation.keys.size, "Expected only one entry from sourceSetB")
assertEquals(sourceSetB, documentation.keys.single(), "Expected only one entry from sourceSetB")
assertEquals("This is moduleB", documentation.texts.single())
@@ -137,7 +137,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert sample_A in sourceSetA`() {
- val documentation = reader[DPackage(DRI("sample.a"), sourceSets = setOf(sourceSetA))]
+ val documentation = reader[dPackage(DRI("sample.a"), sourceSets = setOf(sourceSetA))]
assertEquals(1, documentation.keys.size, "Expected only one entry from sourceSetA")
assertEquals(sourceSetA, documentation.keys.single(), "Expected only one entry from sourceSetA")
assertEquals("This is package sample.a", documentation.texts.single())
@@ -145,7 +145,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert sample_a_sub in sourceSetA`() {
- val documentation = reader[DPackage(DRI("sample.a.sub"), sourceSets = setOf(sourceSetA))]
+ val documentation = reader[dPackage(DRI("sample.a.sub"), sourceSets = setOf(sourceSetA))]
assertEquals(
emptyMap<DokkaSourceSet, DocumentationNode>(), documentation,
"Expected no documentation found for different package"
@@ -154,7 +154,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert sample_a in sourceSetB`() {
- val documentation = reader[DPackage(DRI("sample.a"), sourceSets = setOf(sourceSetB))]
+ val documentation = reader[dPackage(DRI("sample.a"), sourceSets = setOf(sourceSetB))]
assertEquals(
emptyMap<DokkaSourceSet, DocumentationNode>(), documentation,
"Expected no documentation found for different sourceSet"
@@ -163,7 +163,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert sample_b in sourceSetB`() {
- val documentation = reader[DPackage(DRI("sample.b"), sourceSets = setOf(sourceSetB))]
+ val documentation = reader[dPackage(DRI("sample.b"), sourceSets = setOf(sourceSetB))]
assertEquals(1, documentation.keys.size, "Expected only one entry from sourceSetB")
assertEquals(sourceSetB, documentation.keys.single(), "Expected only one entry from sourceSetB")
assertEquals("This is package sample.b", documentation.texts.single())
@@ -171,7 +171,7 @@ class ContextModuleAndPackageDocumentationReaderTest1 : AbstractContextModuleAnd
@Test
fun `assert sample_b in sourceSetB and sourceSetB2`() {
- val documentation = reader[DPackage(DRI("sample.b"), sourceSets = setOf(sourceSetB, sourceSetB2))]
+ val documentation = reader[dPackage(DRI("sample.b"), sourceSets = setOf(sourceSetB, sourceSetB2))]
assertEquals(1, documentation.keys.size, "Expected only one entry from sourceSetB")
assertEquals(sourceSetB, documentation.keys.single(), "Expected only one entry from sourceSetB")
assertEquals("This is package sample.b", documentation.texts.single())
diff --git a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt
index a557379b..9319f5af 100644
--- a/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt
+++ b/plugins/base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt
@@ -8,6 +8,7 @@ import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import testApi.testRunner.TestDokkaConfigurationBuilder
+import testApi.testRunner.dPackage
import testApi.testRunner.dokkaConfiguration
import testApi.testRunner.sourceSet
import kotlin.test.assertEquals
@@ -48,7 +49,7 @@ class ContextModuleAndPackageDocumentationReaderTest3 : AbstractContextModuleAnd
@Test
fun `root package is matched by empty string and the root keyword`() {
- val documentation = reader[DPackage(DRI(""), sourceSets = setOf(sourceSet))]
+ val documentation = reader[dPackage(DRI(""), sourceSets = setOf(sourceSet))]
assertEquals(
listOf("This is the root package", "This is also the root package"), documentation.texts
)
diff --git a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt
index b75f8e5b..9f934f3f 100644
--- a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt
@@ -9,6 +9,7 @@ import org.jetbrains.dokka.model.SourceSetDependent
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import testApi.testRunner.dPackage
import testApi.testRunner.documentationNode
import testApi.testRunner.sourceSet
@@ -139,21 +140,21 @@ class ModuleAndPackageDocumentationTransformerUnitTest {
documentation = emptyMap(),
sourceSets = emptySet(),
packages = listOf(
- DPackage(
+ dPackage(
dri = DRI("com.sample"),
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.sample")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
),
- DPackage(
+ dPackage(
dri = DRI("com.attach"),
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.attach")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C"))
),
- DPackage(
+ dPackage(
dri = DRI("com.attach.sub"),
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.attach.sub"),
@@ -197,7 +198,7 @@ class ModuleAndPackageDocumentationTransformerUnitTest {
documentation = emptyMap(),
sourceSets = emptySet(),
packages = listOf(
- DPackage(
+ dPackage(
dri = DRI("com.sample"),
documentation = mapOf(
/* No documentation added, since in wrong package */
@@ -206,7 +207,7 @@ class ModuleAndPackageDocumentationTransformerUnitTest {
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
),
- DPackage(
+ dPackage(
dri = DRI("com.attach"),
documentation = mapOf(
/* Documentation added */
@@ -215,7 +216,7 @@ class ModuleAndPackageDocumentationTransformerUnitTest {
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
),
- DPackage(
+ dPackage(
dri = DRI("com.attach.sub"),
documentation = mapOf(
/* Documentation added */