aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-02-27 14:50:27 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-17 12:07:18 +0100
commit4002c4e91cb42ef77e93cac57ac49823629d33da (patch)
tree324deff126fd5ff0923f962770a30b880fd04c8e /plugins/base/src/test/kotlin
parent6ed5e125d97e4ddc5b1cd80ed3567fa7bd2e63e6 (diff)
downloaddokka-4002c4e91cb42ef77e93cac57ac49823629d33da.tar.gz
dokka-4002c4e91cb42ef77e93cac57ac49823629d33da.tar.bz2
dokka-4002c4e91cb42ef77e93cac57ac49823629d33da.zip
Add expect with generation
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r--plugins/base/src/test/kotlin/basic/DRITest.kt5
-rw-r--r--plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt9
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt20
-rw-r--r--plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt104
-rw-r--r--plugins/base/src/test/kotlin/expect/ExpectGenerator.kt15
-rw-r--r--plugins/base/src/test/kotlin/expect/ExpectTest.kt70
-rw-r--r--plugins/base/src/test/kotlin/expect/ExpectUtils.kt28
-rw-r--r--plugins/base/src/test/kotlin/issues/IssuesTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/markdown/KDocTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/markdown/ParserTest.kt761
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/model/CommentTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/InheritorsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/model/PackagesTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/PropertyTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt19
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/GroupWrappingTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/PlatformDependentHintTest.kt5
21 files changed, 677 insertions, 393 deletions
diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt
index ca8e4bad..0e1f095e 100644
--- a/plugins/base/src/test/kotlin/basic/DRITest.kt
+++ b/plugins/base/src/test/kotlin/basic/DRITest.kt
@@ -3,10 +3,11 @@ package basic
import org.jetbrains.dokka.links.*
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.pages.asSequence
-import org.junit.Assert.assertEquals
-import org.junit.Test
+import org.junit.jupiter.api.Assertions.assertEquals
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.junit.jupiter.api.Test
+
class DRITest : AbstractCoreTest() {
@Test
fun `#634`() {
diff --git a/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt b/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt
index 0405b91c..dae1b2be 100644
--- a/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt
+++ b/plugins/base/src/test/kotlin/basic/DokkaBasicTests.kt
@@ -2,7 +2,8 @@ package basic
import org.jetbrains.dokka.pages.ClasslikePageNode
import org.jetbrains.dokka.pages.ModulePageNode
-import org.junit.Test
+import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Test
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
class DokkaBasicTests : AbstractCoreTest() {
@@ -31,11 +32,11 @@ class DokkaBasicTests : AbstractCoreTest() {
) {
pagesGenerationStage = {
println(it.dri)
- assert(it.getClasslikeToMemberMap().filterKeys { it.name == "Test" }.entries.firstOrNull()?.value?.size == 5)
+ assertTrue(it.getClasslikeToMemberMap().filterKeys { it.name == "Test" }.entries.firstOrNull()?.value?.size == 5)
}
}
}
- fun ModulePageNode.getClasslikeToMemberMap() =
- this.parentMap.filterValues { it is ClasslikePageNode }.entries.groupBy ({it.value}){it.key}
+ private fun ModulePageNode.getClasslikeToMemberMap() =
+ this.parentMap.filterValues { it is ClasslikePageNode }.entries.groupBy({ it.value }) { it.key }
} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index 34e92d82..55ad0fbc 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -3,9 +3,9 @@ package enums
import org.jetbrains.dokka.model.DEnum
import org.jetbrains.dokka.pages.ClasslikePageNode
import org.jetbrains.dokka.pages.ModulePageNode
-import org.junit.Assert.*
-import org.junit.Test
+import org.junit.jupiter.api.Test
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.junit.jupiter.api.Assertions.*
class EnumsTest : AbstractCoreTest() {
@@ -65,11 +65,11 @@ class EnumsTest : AbstractCoreTest() {
configuration
) {
documentablesCreationStage = {m ->
- assertTrue("Module list cannot be empty", m.isNotEmpty())
+ assertTrue(m.isNotEmpty(), "Module list cannot be empty")
m.first().packages.let { p ->
- assertTrue("Package list cannot be empty", p.isNotEmpty())
+ assertTrue(p.isNotEmpty(), "Package list cannot be empty")
p.first().classlikes.let { c ->
- assertTrue("Classlikes list cannot be empty", c.isNotEmpty())
+ assertTrue(c.isNotEmpty(), "Classlikes list cannot be empty")
val enum = c.first() as DEnum
assertEquals(enum.name, "Test")
@@ -78,12 +78,12 @@ class EnumsTest : AbstractCoreTest() {
}
}
}
- pagesGenerationStage = {
- val map = it.getClasslikeToMemberMap()
+ pagesGenerationStage = { module ->
+ val map = module.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" }
+ assertNotNull(test, "Test not found")
+ assertTrue(test!!.any { it.name == "E1" } && test.any { it.name == "E2" }) { "Enum entries missing in parent" }
+ assertTrue(map.keys.any { it.name == "E1" } && map.keys.any { it.name == "E2" }) { "Enum entries missing" }
}
}
}
diff --git a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt
new file mode 100644
index 00000000..ef97b04c
--- /dev/null
+++ b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt
@@ -0,0 +1,104 @@
+package expect
+
+import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.junit.jupiter.api.Assertions.assertTrue
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.Paths
+import java.util.concurrent.TimeUnit
+
+abstract class AbstractExpectTest(
+ val testDir: Path? = Paths.get("src/test", "resources", "expect"),
+ val formats: List<String> = listOf("html")
+) : AbstractCoreTest() {
+
+ protected fun generateOutput(path: Path, outFormat: String): Path? {
+ val config = dokkaConfiguration {
+ format = outFormat
+ passes {
+ pass {
+ sourceRoots = listOf(path.asString())
+ }
+ }
+ }
+
+ var result: Path? = null
+ testFromData(config, cleanupOutput = false) {
+ renderingStage = { _, context -> result = Paths.get(context.configuration.outputDir) }
+ }
+ return result
+ }
+
+ protected fun compareOutput(expected: Path, obtained: Path?, gitTimeout: Long = 500) {
+ obtained?.let { path ->
+ val gitCompare = ProcessBuilder(
+ "git",
+ "--no-pager",
+ "diff",
+ expected.asString(),
+ path.asString()
+ ).also { logger.info("git diff command: ${it.command().joinToString(" ")}") }
+ .also { it.redirectErrorStream() }.start()
+
+ assertTrue(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS)) { "Git timed out after $gitTimeout" }
+ gitCompare.inputStream.bufferedReader().lines().forEach { logger.info(it) }
+ assertTrue(gitCompare.exitValue() == 0) { "${path.fileName}: outputs don't match" }
+ } ?: throw AssertionError("obtained path is null")
+ }
+
+ protected fun compareOutputWithExcludes(
+ expected: Path,
+ obtained: Path?,
+ excludes: List<String>,
+ timeout: Long = 500
+ ) {
+ obtained?.let { path ->
+ val (res, out, err) = runDiff(expected, obtained, excludes, timeout)
+ assertTrue(res == 0, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}")
+ } ?: throw AssertionError("obtained path is null")
+ }
+
+ protected fun runDiff(exp: Path, obt: Path, excludes: List<String>, timeout: Long): ProcessResult =
+ ProcessBuilder().command(
+ listOf("diff", "-ru") + excludes.flatMap { listOf("-x", it) } + listOf("--", exp.asString(), obt.asString())
+ ).also {
+ it.redirectErrorStream()
+ }.start().also { assertTrue(it.waitFor(timeout, TimeUnit.MILLISECONDS), "diff timed out") }.let {
+ ProcessResult(it.exitValue(), it.inputStream.bufferResult())
+ }
+
+
+ protected fun testOutput(p: Path, outFormat: String) {
+ val expectOut = p.resolve("out/$outFormat")
+ val testOut = generateOutput(p.resolve("src"), outFormat)
+ .also { logger.info("Test out: ${it?.asString()}") }
+
+ compareOutput(expectOut.toAbsolutePath(), testOut?.toAbsolutePath())
+ testOut?.deleteRecursively()
+ }
+
+ protected fun testOutputWithExcludes(
+ p: Path,
+ outFormat: String,
+ ignores: List<String> = emptyList(),
+ timeout: Long = 500
+ ) {
+ val expected = p.resolve("out/$outFormat")
+ generateOutput(p.resolve("src"), outFormat)
+ ?.let { obtained ->
+ compareOutputWithExcludes(expected, obtained, ignores, timeout)
+
+ obtained.deleteRecursively()
+ } ?: throw AssertionError("Output not generated for ${p.fileName}")
+ }
+
+ protected fun generateExpect(p: Path, outFormat: String) {
+ val out = p.resolve("out/$outFormat/")
+ Files.createDirectories(out)
+
+ val ret = generateOutput(p.resolve("src"), outFormat)
+ Files.list(out).forEach { it.deleteRecursively() }
+ ret?.let { Files.list(it).forEach { f -> f.copyRecursively(out.resolve(f.fileName)) } }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt b/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt
new file mode 100644
index 00000000..667fc249
--- /dev/null
+++ b/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt
@@ -0,0 +1,15 @@
+package expect
+
+import org.junit.jupiter.api.Disabled
+import org.junit.jupiter.api.Test
+import java.nio.file.Files
+import java.nio.file.Path
+
+class ExpectGenerator : AbstractExpectTest() {
+
+ @Disabled
+ @Test
+ fun generateAll() = testDir?.dirsWithFormats(formats).orEmpty().forEach { (p, f) ->
+ generateExpect(p, f)
+ }
+} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/expect/ExpectTest.kt b/plugins/base/src/test/kotlin/expect/ExpectTest.kt
index c6c252ed..0423a5b4 100644
--- a/plugins/base/src/test/kotlin/expect/ExpectTest.kt
+++ b/plugins/base/src/test/kotlin/expect/ExpectTest.kt
@@ -1,62 +1,18 @@
package expect
-import org.junit.Test
-import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
-import java.nio.file.Files
-import java.nio.file.Path
-import java.nio.file.Paths
-import java.util.concurrent.TimeUnit
-
-class ExpectTest : AbstractCoreTest() {
-
- private fun generateOutput(path: Path): Path? {
- val config = dokkaConfiguration {
- passes {
- pass {
- sourceRoots = listOf(path.asString())
- }
- }
- }
-
- var result: Path? = null
- testFromData(config, cleanupOutput = false) {
- renderingStage = { _, context -> result = Paths.get(context.configuration.outputDir) }
- }
- return result
- }
-
- private fun compareOutput(expected: Path, obtained: Path?, gitTimeout: Long = 500) {
- obtained?.let { path ->
- val gitCompare = ProcessBuilder(
- "git",
- "--no-pager",
- "diff",
- expected.asString(),
- path.asString()
- ).also { logger.info("git diff command: ${it.command().joinToString(" ")}") }
- .start()
-
- assert(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS)) { "Git timed out after $gitTimeout" }
- gitCompare.inputStream.bufferedReader().lines().forEach { logger.info(it) }
- gitCompare.errorStream.bufferedReader().lines().forEach { logger.info(it) }
- assert(gitCompare.exitValue() == 0) { "${path.fileName}: outputs don't match" }
- } ?: throw AssertionError("obtained path is null")
+import org.junit.jupiter.api.DynamicTest.dynamicTest
+import org.junit.jupiter.api.TestFactory
+
+class ExpectTest : AbstractExpectTest() {
+ private val ignores: List<String> = listOf(
+ "*.js",
+ "*.css",
+ "*.svg"
+ )
+
+ @TestFactory
+ fun expectTest() = testDir?.dirsWithFormats(formats).orEmpty().map { (p, f) ->
+ dynamicTest("${p.fileName}-$f") { testOutputWithExcludes(p, f, ignores) }
}
- @Test
- fun expectTest() {
- val sources = Paths.get("src/test", "resources", "expect")
-
- Files.list(sources).forEach { p ->
- val expectOut = p.resolve("out")
- val testOut = generateOutput(p.resolve("src"))
- .also { logger.info("Test out: ${it?.asString()}") }
-
- compareOutput(expectOut, testOut)
- testOut?.toFile()?.deleteRecursively()
- }
- }
-
- fun Path.asString() = toAbsolutePath().normalize().toString()
-
} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/expect/ExpectUtils.kt b/plugins/base/src/test/kotlin/expect/ExpectUtils.kt
new file mode 100644
index 00000000..4ea46dda
--- /dev/null
+++ b/plugins/base/src/test/kotlin/expect/ExpectUtils.kt
@@ -0,0 +1,28 @@
+package expect
+
+import java.io.InputStream
+import java.nio.file.Files
+import java.nio.file.Path
+import kotlin.streams.toList
+
+data class ProcessResult(val code: Int, val out: String, val err: String? = null)
+
+internal fun Path.dirsWithFormats(formats: List<String>): List<Pair<Path, String>> =
+ Files.list(this).toList().flatMap { p -> formats.map { p to it } }
+
+internal fun Path.asString() = normalize().toString()
+internal fun Path.deleteRecursively() = toFile().deleteRecursively()
+
+internal fun Path.copyRecursively(target: Path) = toFile().copyRecursively(target.toFile())
+
+internal fun Path.listRecursively(filter: (Path) -> Boolean): List<Path> = when {
+ Files.isDirectory(this) -> listOfNotNull(takeIf(filter)) + Files.list(this).toList().flatMap {
+ it.listRecursively(
+ filter
+ )
+ }
+ Files.isRegularFile(this) -> listOfNotNull(this.takeIf(filter))
+ else -> emptyList()
+ }
+
+internal fun InputStream.bufferResult(): String = this.bufferedReader().lines().toList().joinToString("\n") \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/issues/IssuesTest.kt b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
index 1ad7a97b..41fc2632 100644
--- a/plugins/base/src/test/kotlin/issues/IssuesTest.kt
+++ b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
@@ -2,7 +2,7 @@ package issues
import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.DFunction
-import org.junit.Test
+import org.junit.jupiter.api.Test
import utils.AbstractModelTest
import utils.name
diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt
index fa538c3e..a904f725 100644
--- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt
@@ -3,7 +3,7 @@ package markdown
import org.jetbrains.dokka.model.DPackage
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.pages.ModulePageNode
-import org.junit.Assert
+import org.junit.jupiter.api.Assertions.*
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
open class KDocTest : AbstractCoreTest() {
@@ -37,7 +37,7 @@ open class KDocTest : AbstractCoreTest() {
configuration
) {
pagesGenerationStage = {
- Assert.assertEquals(
+ assertEquals(
expectedDocumentationNode,
actualDocumentationNode(it)
)
diff --git a/plugins/base/src/test/kotlin/markdown/ParserTest.kt b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
index dee8e907..332c9766 100644
--- a/plugins/base/src/test/kotlin/markdown/ParserTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
@@ -2,13 +2,14 @@ package org.jetbrains.dokka.tests
import markdown.KDocTest
import org.jetbrains.dokka.model.doc.*
-import org.junit.Ignore
-import org.junit.Test
+import org.junit.jupiter.api.Disabled
+import org.junit.jupiter.api.Test
class ParserTest : KDocTest() {
- @Test fun `Simple text`() {
+ @Test
+ fun `Simple text`() {
val kdoc = """
| This is simple test of string
| Next line
@@ -23,7 +24,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Simple text with new line`() {
+ @Test
+ fun `Simple text with new line`() {
val kdoc = """
| This is simple test of string\
| Next line
@@ -31,18 +33,21 @@ class ParserTest : KDocTest() {
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
- P(listOf(
- Text("This is simple test of string"),
- Br,
- Text("Next line")
- ))
+ P(
+ listOf(
+ Text("This is simple test of string"),
+ Br,
+ Text("Next line")
+ )
+ )
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Text with Bold and Emphasis decorators`() {
+ @Test
+ fun `Text with Bold and Emphasis decorators`() {
val kdoc = """
| This is **simple** test of _string_
| Next **_line_**
@@ -66,7 +71,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Text with Colon`() {
+ @Test
+ fun `Text with Colon`() {
val kdoc = """
| This is simple text with: colon!
""".trimMargin()
@@ -80,7 +86,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Multilined text`() {
+ @Test
+ fun `Multilined text`() {
val kdoc = """
| Text
| and
@@ -96,7 +103,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Paragraphs`() {
+ @Test
+ fun `Paragraphs`() {
val kdoc = """
| Paragraph number
| one
@@ -119,7 +127,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Emphasis with star`() {
+ @Test
+ fun `Emphasis with star`() {
val kdoc = " *text*"
val expectedDocumentationNode = DocumentationNode(
listOf(
@@ -131,7 +140,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Underscores that are not Emphasis`() {
+ @Test
+ fun `Underscores that are not Emphasis`() {
val kdoc = "text_with_underscores"
val expectedDocumentationNode = DocumentationNode(
listOf(
@@ -143,7 +153,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Emphasis with underscores`() {
+ @Test
+ fun `Emphasis with underscores`() {
val kdoc = "_text_"
val expectedDocumentationNode = DocumentationNode(
listOf(
@@ -155,7 +166,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Embedded star`() {
+ @Test
+ fun `Embedded star`() {
val kdoc = "Embedded*Star"
val expectedDocumentationNode = DocumentationNode(
listOf(
@@ -168,7 +180,8 @@ class ParserTest : KDocTest() {
}
- @Test fun `Unordered list`() {
+ @Test
+ fun `Unordered list`() {
val kdoc = """
| * list item 1
| * list item 2
@@ -188,7 +201,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Unordered list with multilines`() {
+ @Test
+ fun `Unordered list with multilines`() {
val kdoc = """
| * list item 1
| continue 1
@@ -210,7 +224,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Unordered list with Bold`() {
+ @Test
+ fun `Unordered list with Bold`() {
val kdoc = """
| * list **item** 1
| continue 1
@@ -220,25 +235,40 @@ class ParserTest : KDocTest() {
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
- Ul(listOf(
- Li(listOf(P(listOf(
- Text("list "),
- B(listOf(Text("item"))),
- Text(" 1 continue 1")
- )))),
- Li(listOf(P(listOf(
- Text("list "),
- B(listOf(Text("item"))),
- Text(" 2 continue 2")
- ))))
- ))
+ Ul(
+ listOf(
+ Li(
+ listOf(
+ P(
+ listOf(
+ Text("list "),
+ B(listOf(Text("item"))),
+ Text(" 1 continue 1")
+ )
+ )
+ )
+ ),
+ Li(
+ listOf(
+ P(
+ listOf(
+ Text("list "),
+ B(listOf(Text("item"))),
+ Text(" 2 continue 2")
+ )
+ )
+ )
+ )
+ )
+ )
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Unordered list with nested bullets`() {
+ @Test
+ fun `Unordered list with nested bullets`() {
val kdoc = """
| * Outer first
| Outer next line
@@ -255,29 +285,38 @@ class ParserTest : KDocTest() {
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
- P(listOf(
- Ul(listOf(
- Li(listOf(P(listOf(Text("Outer first Outer next line"))))),
- Li(listOf(P(listOf(Text("Outer second"))))),
- Ul(listOf(
- Li(listOf(P(listOf(Text("Middle first Middle next line"))))),
- Li(listOf(P(listOf(Text("Middle second"))))),
- Ul(listOf(
- Li(listOf(P(listOf(Text("Inner first Inner next line")))))
- )),
- Li(listOf(P(listOf(Text("Middle third")))))
- )),
- Li(listOf(P(listOf(Text("Outer third")))))
- )),
- P(listOf(Text("New paragraph")))
- ))
+ P(
+ listOf(
+ Ul(
+ listOf(
+ Li(listOf(P(listOf(Text("Outer first Outer next line"))))),
+ Li(listOf(P(listOf(Text("Outer second"))))),
+ Ul(
+ listOf(
+ Li(listOf(P(listOf(Text("Middle first Middle next line"))))),
+ Li(listOf(P(listOf(Text("Middle second"))))),
+ Ul(
+ listOf(
+ Li(listOf(P(listOf(Text("Inner first Inner next line")))))
+ )
+ ),
+ Li(listOf(P(listOf(Text("Middle third")))))
+ )
+ ),
+ Li(listOf(P(listOf(Text("Outer third")))))
+ )
+ ),
+ P(listOf(Text("New paragraph")))
+ )
+ )
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Ordered list`() {
+ @Test
+ fun `Ordered list`() {
val kdoc = """
| 1. list item 1
| 2. list item 2
@@ -299,7 +338,8 @@ class ParserTest : KDocTest() {
}
- @Test fun `Ordered list beginning from other number`() {
+ @Test
+ fun `Ordered list beginning from other number`() {
val kdoc = """
| 9. list item 1
| 12. list item 2
@@ -320,7 +360,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Ordered list with multilines`() {
+ @Test
+ fun `Ordered list with multilines`() {
val kdoc = """
| 2. list item 1
| continue 1
@@ -343,7 +384,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Ordered list with Bold`() {
+ @Test
+ fun `Ordered list with Bold`() {
val kdoc = """
| 1. list **item** 1
| continue 1
@@ -353,17 +395,30 @@ class ParserTest : KDocTest() {
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
- Ol(listOf(
- Li(listOf(P(listOf(
- Text("list "),
- B(listOf(Text("item"))),
- Text(" 1 continue 1")
- )))),
- Li(listOf(P(listOf(
- Text("list "),
- B(listOf(Text("item"))),
- Text(" 2 continue 2")
- ))))
+ Ol(
+ listOf(
+ Li(
+ listOf(
+ P(
+ listOf(
+ Text("list "),
+ B(listOf(Text("item"))),
+ Text(" 1 continue 1")
+ )
+ )
+ )
+ ),
+ Li(
+ listOf(
+ P(
+ listOf(
+ Text("list "),
+ B(listOf(Text("item"))),
+ Text(" 2 continue 2")
+ )
+ )
+ )
+ )
),
mapOf("start" to "1")
)
@@ -373,7 +428,8 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
- @Test fun `Ordered list with nested bullets`() {
+ @Test
+ fun `Ordered list with nested bullets`() {
val kdoc = """
| 1. Outer first
| Outer next line
@@ -390,35 +446,41 @@ class ParserTest : KDocTest() {
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
- P(listOf(
- Ol(listOf(
- Li(listOf(P(listOf(Text("Outer first Outer next line"))))),
- Li(listOf(P(listOf(Text("Outer second"))))),
- Ol(listOf(
- Li(listOf(P(listOf(Text("Middle first Middle next line"))))),
- Li(listOf(P(listOf(Text("Middle second"))))),
- Ol(listOf(
- Li(listOf(P(listOf(Text("Inner first Inner next line")))))
+ P(
+ listOf(
+ Ol(
+ listOf(
+ Li(listOf(P(listOf(Text("Outer first Outer next line"))))),
+ Li(listOf(P(listOf(Text("Outer second"))))),
+ Ol(
+ listOf(
+ Li(listOf(P(listOf(Text("Middle first Middle next line"))))),
+ Li(listOf(P(listOf(Text("Middle second"))))),
+ Ol(
+ listOf(
+ Li(listOf(P(listOf(Text("Inner first Inner next line")))))
+ ),
+ mapOf("start" to "1")
+ ),
+ Li(listOf(P(listOf(Text("Middle third")))))
+ ),
+ mapOf("start" to "1")
),
-