aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/enums
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2020-02-12 18:05:24 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-02-18 13:28:23 +0100
commit46b4bbb68ce1285a1aea700cc0d0000c6b7ed97b (patch)
tree862f5283fd2db16b973422dc60491760fa556262 /plugins/base/src/test/kotlin/enums
parentc4c6a165d968fefbf8caa52b9c9763b58fc39803 (diff)
downloaddokka-46b4bbb68ce1285a1aea700cc0d0000c6b7ed97b.tar.gz
dokka-46b4bbb68ce1285a1aea700cc0d0000c6b7ed97b.tar.bz2
dokka-46b4bbb68ce1285a1aea700cc0d0000c6b7ed97b.zip
Moves all core tests to base plugin
Diffstat (limited to 'plugins/base/src/test/kotlin/enums')
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
new file mode 100644
index 00000000..efc46595
--- /dev/null
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -0,0 +1,45 @@
+package enums
+
+import org.jetbrains.dokka.pages.ClasslikePageNode
+import org.jetbrains.dokka.pages.ModulePageNode
+import org.junit.Test
+import testApi.testRunner.AbstractCoreTest
+
+class EnumsTest : AbstractCoreTest() {
+
+ @Test
+ fun basicEnums() {
+ val configuration = dokkaConfiguration {
+ passes {
+ pass {
+ sourceRoots = listOf("src/")
+ }
+ }
+ }
+
+ testInline(
+ """
+ |/src/main/kotlin/basic/Test.kt
+ |package enums
+ |
+ |enum class Test {
+ | E1,
+ | E2
+ |}
+ """.trimMargin(),
+ configuration
+ ) {
+ pagesGenerationStage = {
+ val map = it.getClasslikeToMemberMap()
+ val test = map.filterKeys { it.name == "Test" }.values.firstOrNull()
+ assert(test != null) { "Test not found" }
+ assert(test!!.any { it.name == "E1" } && test.any { it.name == "E2" }) { "Enum entries missing in parent" }
+ assert(map.keys.any { it.name == "E1" } && map.keys.any { it.name == "E2" }) { "Enum entries missing" }
+ }
+ }
+ }
+
+
+ fun ModulePageNode.getClasslikeToMemberMap() =
+ this.parentMap.filterValues { it is ClasslikePageNode }.entries.groupBy({ it.value }) { it.key }
+} \ No newline at end of file