From 7e572b6341bc7da3eeed4aef41665097ebad9f35 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Tue, 29 Sep 2020 11:06:02 +0200 Subject: Fix failing tests --- .../test/kotlin/content/annotations/ContentForAnnotationsTest.kt | 6 +++--- .../test/kotlin/content/signatures/ContentForSignaturesTest.kt | 8 ++++---- .../base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt | 6 +++--- plugins/base/src/test/kotlin/utils/contentUtils.kt | 6 +++++- 4 files changed, 15 insertions(+), 11 deletions(-) (limited to 'plugins/base/src') diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt index bf78b847..d5779b61 100644 --- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt @@ -132,7 +132,7 @@ class ContentForAnnotationsTest : AbstractCoreTest() { pagesTransformationStage = { module -> val page = module.children.single { it.name == "test" } as PackagePageNode page.content.assertNode { - propertySignature(emptyMap(), "", "", emptySet(), "val", "property", "Int") + propertySignature(emptyMap(), "", "", emptySet(), "val", "property", "Int", "6") } } } @@ -155,7 +155,7 @@ class ContentForAnnotationsTest : AbstractCoreTest() { pagesTransformationStage = { module -> val page = module.children.single { it.name == "test" } as PackagePageNode page.content.assertNode { - propertySignature(mapOf("Fancy" to emptySet()), "", "", emptySet(), "val", "property", "Int") + propertySignature(mapOf("Fancy" to emptySet()), "", "", emptySet(), "val", "property", "Int", "6") } } } @@ -212,7 +212,7 @@ class ContentForAnnotationsTest : AbstractCoreTest() { "reportedBy", "showStopper" ) - ), "", "", emptySet(), "val", "ltint", "Int" + ), "", "", emptySet(), "val", "ltint", "Int", "5" ) } } diff --git a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt index 908109bf..b4c2623c 100644 --- a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt @@ -310,7 +310,7 @@ class ContentForSignaturesTest : AbstractCoreTest() { pagesTransformationStage = { module -> val page = module.children.single { it.name == "test" } as PackagePageNode page.content.assertNode { - propertySignature(emptyMap(), "", "", emptySet(), "val", "property", "Int") + propertySignature(emptyMap(), "", "", emptySet(), "val", "property", "Int", "6") } } } @@ -329,7 +329,7 @@ class ContentForSignaturesTest : AbstractCoreTest() { pagesTransformationStage = { module -> val page = module.children.single { it.name == "test" } as PackagePageNode page.content.assertNode { - propertySignature(emptyMap(), "", "", setOf("const"), "val", "property", "Int") + propertySignature(emptyMap(), "", "", setOf("const"), "val", "property", "Int", "6") } } } @@ -348,7 +348,7 @@ class ContentForSignaturesTest : AbstractCoreTest() { pagesTransformationStage = { module -> val page = module.children.single { it.name == "test" } as PackagePageNode page.content.assertNode { - propertySignature(emptyMap(), "protected", "", emptySet(), "val", "property", "Int") + propertySignature(emptyMap(), "protected", "", emptySet(), "val", "property", "Int", "6") } } } @@ -367,7 +367,7 @@ class ContentForSignaturesTest : AbstractCoreTest() { pagesTransformationStage = { module -> val page = module.children.single { it.name == "test" } as PackagePageNode page.content.assertNode { - propertySignature(emptyMap(), "protected", "", setOf("lateinit"), "var", "property", "Int") + propertySignature(emptyMap(), "protected", "", setOf("lateinit"), "var", "property", "Int", "6") } } } diff --git a/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt b/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt index e8265667..dfd80a54 100644 --- a/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt +++ b/plugins/base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt @@ -54,8 +54,8 @@ class ObviousTypeSkippingTest : AbstractCoreTest( forFunction("fun underTest(arg: T) {}", "fun underTest(arg: T)"), forFunction("fun underTest(arg: T) {}", "fun underTest(arg: T)"), forFunction("fun underTest(arg: T) {}", "fun underTest(arg: T)"), - forProperty("val underTest: Int = 5", "val underTest: Int"), - forProperty("val underTest = 5", "val underTest: Int"), + forProperty("val underTest: Int = 5", "val underTest: Int = 5"), + forProperty("val underTest = 5", "val underTest: Int = 5"), forProperty("val underTest: Unit = println(5)", "val underTest: Unit"), forProperty("val underTest = println(5)", "val underTest: Unit"), forProperty("val underTest: Unit? = if (true) println(5) else null", "val underTest: Unit?"), @@ -192,4 +192,4 @@ private fun forClass(codeFragment: String, expectedSignature: String, className: expectedSignature, OnParentPage(PackagePageNode::class, ContentKind.Classlikes), OnOwnPage(className) - ) \ No newline at end of file + ) diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt index 7fcd8e89..4cb3cfea 100644 --- a/plugins/base/src/test/kotlin/utils/contentUtils.kt +++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt @@ -129,7 +129,8 @@ fun ContentMatcherBuilder<*>.propertySignature( keywords: Set, preposition: String, name: String, - type: String? = null + type: String? = null, + value: String? = null ) { group { header { +"Package test" } @@ -159,6 +160,9 @@ fun ContentMatcherBuilder<*>.propertySignature( } } } + if (type != null) { + +(" = $value") + } } } } -- cgit