diff options
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r-- | plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt | 9 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/signatures/SignatureTest.kt | 26 |
2 files changed, 33 insertions, 2 deletions
diff --git a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt index 508a0a36..b6fc4e6b 100644 --- a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt @@ -122,7 +122,7 @@ class ConstructorsSignaturesTest : BaseAbstractTest() { |/src/main/kotlin/test/source.kt |package test | - |class SomeClass(val a: String) + |class SomeClass(val a: String, var i: Int) | """.trimIndent(), testConfiguration ) { @@ -139,8 +139,13 @@ class ConstructorsSignaturesTest : BaseAbstractTest() { +"(" group { group { - +"a: " // TODO: Make sure if we still do not want to have "val" here + +"val a: " group { link { +"String" } } + +", " + } + group { + +"var i: " + group { link { +"Int" } } } } +")" diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index 7ab0f663..ddf1c892 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -745,6 +745,32 @@ class SignatureTest : BaseAbstractTest() { } @Test + fun `primary constructor with properties check for all tokens`() { + val writerPlugin = TestOutputWriterPlugin() + + testInline( + """ + |/src/main/kotlin/common/Test.kt + |package example + | + |class PrimaryConstructorClass<T>(val x: Int, var s: String) { } + """.trimMargin(), + configuration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + writerPlugin.writer.renderedContent("root/example/-primary-constructor-class/index.html").firstSignature().match( + // In `<T>` expression, an empty `<span class="token keyword"></span>` is present for some reason + Span("class "), A("PrimaryConstructorClass"), Span("<"), Span(), A("T"), Span(">"), Span("("), Parameters( + Parameter(Span("val "), "x", Span(": "), A("Int"), Span(",")), + Parameter(Span("var "), "s", Span(": "), A("String")) + ), Span(")"), Span(), + ) + } + } + } + + @Test fun `fun with default values`() { val source = source("fun simpleFun(int: Int = 1, string: String = \"string\"): String = \"\"") val writerPlugin = TestOutputWriterPlugin() |