From 2274d9261a59570cc3a1a26c3f7ddc167678fe8b Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Fri, 18 Sep 2020 15:53:37 +0200 Subject: Add default values for primitive proprties. Add presenting in signature default values --- .../src/test/kotlin/signatures/SignatureTest.kt | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'plugins/base/src/test/kotlin') diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index f5b1bf2e..c6a52271 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -523,4 +523,41 @@ class SignatureTest : AbstractCoreTest() { } } } + + @Test + fun `fun with default values`() { + val source = source("fun simpleFun(int: Int = 1, string: String = \"string\"): String = \"\"") + val writerPlugin = TestOutputWriterPlugin() + + testInline( + source, + configuration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match( + "fun", A("simpleFun"), "(int: ", A("Int"), " = 1, string: ", A("String"), + " = \"string\"): ", A("String"), Span() + ) + } + } + } + + @Test + fun `const val with default values`() { + val source = source("const val simpleVal = 1") + val writerPlugin = TestOutputWriterPlugin() + + testInline( + source, + configuration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + writerPlugin.writer.renderedContent("root/example.html").firstSignature().match( + "const val ", A("simpleVal"), ": ", A("Int"), " = 1", Span() + ) + } + } + } } -- cgit