aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/signatures
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-08-18 13:51:58 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-20 15:36:07 +0200
commite4fc2c274fd982b2742eac46581b504b56b2b48f (patch)
tree7f2bad819d0bf4811de1ec89ad7611df9cdab2bc /plugins/base/src/test/kotlin/signatures
parent54df62709a37fc8f55bded26fd5db15f9eb0fd25 (diff)
downloaddokka-e4fc2c274fd982b2742eac46581b504b56b2b48f.tar.gz
dokka-e4fc2c274fd982b2742eac46581b504b56b2b48f.tar.bz2
dokka-e4fc2c274fd982b2742eac46581b504b56b2b48f.zip
Add some tests
Diffstat (limited to 'plugins/base/src/test/kotlin/signatures')
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt57
1 files changed, 57 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index f7439d67..f33ad5bd 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -450,6 +450,63 @@ class SignatureTest : AbstractCoreTest() {
}
}
+ @Test
+ fun `generic constructor params`() {
+
+ val configuration = dokkaConfiguration {
+ sourceSets {
+ sourceSet {
+ moduleName = "test"
+ name = "common"
+ sourceRoots = listOf("src/main/kotlin/common/Test.kt")
+ }
+ }
+ }
+
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ """
+ |/src/main/kotlin/common/Test.kt
+ |package example
+ |
+ |import java.util.*
+ |
+ |class GenericClass<T>(val x: Int) {
+ | constructor(x: T) : this(1)
+ |
+ | constructor(x: Int, y: String) : this(1)
+ |
+ | constructor(x: Int, y: List<T>) : this(1)
+ |
+ | constructor(x: Boolean, y: Int, z: String) : this(1)
+ |
+ | constructor(x: List<Comparable<ServiceLoader<T>>>?) : this(1)
+ |}
+ |
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ writerPlugin.writer.renderedContent("test/example/-generic-class/-generic-class.html").signature().zip(
+ listOf(
+ arrayOf("fun <", A("T"), "> ", A("GenericClass"), "(x: ", A("T"), ")", Span()),
+ arrayOf("fun ", A("GenericClass"), "(x: ", A("Int"), ", y: ", A("String"), ")", Span()),
+ arrayOf("fun <", A("T"), "> ", A("GenericClass"), "(x: ", A("Int"), ", y: ", A("List"), "<", A("T"), ">)", Span()),
+ arrayOf("fun ", A("GenericClass"), "(x: ", A("Boolean"), ", y: ", A("Int"), ", z:", A("String"), ")", Span()),
+ arrayOf("fun <", A("T"), "> ", A("GenericClass"), "(x: ", A("List"), "<", A("Comparable"),
+ "<", A("ServiceLoader"), "<", A("T"), ">>>?)", Span()),
+ arrayOf("fun ", A("GenericClass"), "(x: ", A("Int"), ")", Span()),
+
+ )
+ ).forEach {
+ it.first.match(*it.second)
+ }
+ }
+ }
+ }
+
private fun TestOutputWriter.renderedContent(path: String = "root/example.html") =
contents.getValue(path).let { Jsoup.parse(it) }.select("#content")
.single()