aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-02-05 13:25:54 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-02-12 13:33:10 +0100
commit59aed423949587f0fc72c4f2712fe36ae1de12bd (patch)
treeb4df92f538610ac30cad8af6ffd350e5fb314759
parent8c534f14296a92fedc3410fb48de51836cb92859 (diff)
downloaddokka-59aed423949587f0fc72c4f2712fe36ae1de12bd.tar.gz
dokka-59aed423949587f0fc72c4f2712fe36ae1de12bd.tar.bz2
dokka-59aed423949587f0fc72c4f2712fe36ae1de12bd.zip
test
-rw-r--r--core/src/test/kotlin/pageMerger/DefaultPageNodeMergerTest.kt51
1 files changed, 51 insertions, 0 deletions
diff --git a/core/src/test/kotlin/pageMerger/DefaultPageNodeMergerTest.kt b/core/src/test/kotlin/pageMerger/DefaultPageNodeMergerTest.kt
new file mode 100644
index 00000000..432820af
--- /dev/null
+++ b/core/src/test/kotlin/pageMerger/DefaultPageNodeMergerTest.kt
@@ -0,0 +1,51 @@
+package pageMerger
+
+import org.jetbrains.dokka.pages.ContentPage
+import org.jetbrains.dokka.pages.PageNode
+import org.junit.Test
+import testApi.testRunner.AbstractCoreTest
+
+class DefaultPageNodeMergerTest : AbstractCoreTest() {
+
+ @Test
+ fun test1() {
+ val configuration = dokkaConfiguration {
+ passes {
+ pass {
+ sourceRoots = listOf("src/main/kotlin/pageMerger/Test.kt")
+ }
+ }
+ }
+
+ testInline(
+ """
+ |/src/main/kotlin/pageMerger/Test.kt
+ |package pageMerger
+ |
+ |fun testT(): Int = 1
+ |fun testT(i: Int): Int = i
+ |
+ |object Test {
+ | fun test(): String = ""
+ | fun test(str: String): String = str
+ |}
+ """.trimMargin(),
+ configuration
+ ) {
+ pagesTransformationStage = {
+ val allChildren = it.childrenRec().filterIsInstance<ContentPage>()
+ val testT = allChildren.filter { it.name == "testT" }
+ val test = allChildren.filter { it.name == "test" }
+
+ assert(testT.size == 1) { "There can be only one testT page" }
+ assert(testT.first().dri.size == 2) { "testT page should have 2 DRI" }
+
+ assert(test.size == 1) { "There can be only one test page" }
+ assert(test.first().dri.size == 2) { "test page should have 2 DRI" }
+ }
+ }
+ }
+
+ fun PageNode.childrenRec(): List<PageNode> = listOf(this) + children.flatMap { it.childrenRec() }
+
+} \ No newline at end of file