aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/signatures/SignatureTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt104
1 files changed, 104 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index 421dd97f..dd3d85c1 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -425,6 +425,110 @@ class SignatureTest : AbstractCoreTest() {
}
}
+ @Test
+ fun `plain typealias of plain class`() {
+
+ 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
+ |
+ |typealias PlainTypealias = Int
+ |
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ writerPlugin.writer.renderedContent("test/example.html").signature().first().match(
+ "typealias ", A("PlainTypealias"), " = ", A("Int"), Span()
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `plain typealias of generic class`() {
+
+ 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
+ |
+ |typealias PlainTypealias = Comparable<Int>
+ |
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ writerPlugin.writer.renderedContent("test/example.html").signature().first().match(
+ "typealias ", A("PlainTypealias"), " = ", A("Comparable"),
+ "<", A("Int"), ">", Span()
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `typealias with generics 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
+ |
+ |typealias GenericTypealias<T> = Comparable<T>
+ |
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ writerPlugin.writer.renderedContent("test/example.html").signature().first().match(
+ "typealias ", A("GenericTypealias"), "<", A("T"), "> = ", A("Comparable"),
+ "<", A("T"), ">", Span()
+ )
+ }
+ }
+ }
+
private fun TestOutputWriter.renderedContent(path: String = "root/example.html") =
contents.getValue(path).let { Jsoup.parse(it) }.select("#content")
.single()