aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/signatures
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/signatures')
-rw-r--r--plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt44
3 files changed, 48 insertions, 4 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
index 66d84967..374f2a6a 100644
--- a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
@@ -275,7 +275,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-java-class/index.html").lastSignature().match(
- "open val ", A("javaFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
+ "open var ", A("javaFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
ignoreSpanWithTokenStyle = true
)
}
@@ -301,7 +301,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-java-class/index.html").lastSignature().match(
- "open val ", A("kotlinFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
+ "open var ", A("kotlinFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
ignoreSpanWithTokenStyle = true
)
}
diff --git a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
index d3e03666..76e02c34 100644
--- a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
@@ -213,7 +213,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
val property = signatures[4]
property.match(
- "val ", A("a"), ":", A("Int"), Span(),
+ "var ", A("a"), ":", A("Int"), Span(),
ignoreSpanWithTokenStyle = true
)
}
@@ -421,7 +421,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
val property = signatures[2]
property.match(
- "protected val ", A("protectedProperty"), ":", A("Int"), Span(),
+ "protected var ", A("protectedProperty"), ":", A("Int"), Span(),
ignoreSpanWithTokenStyle = true
)
}
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index b021fae1..79089967 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -951,4 +951,48 @@ class SignatureTest : BaseAbstractTest() {
}
}
}
+
+ @Test
+ fun `java property without accessors should be var`() {
+ val writerPlugin = TestOutputWriterPlugin()
+ testInline(
+ """
+ |/src/test/JavaClass.java
+ |package test;
+ |public class JavaClass {
+ | public int property = 0;
+ |}
+ |
+ |/src/test/KotlinClass.kt
+ |package test
+ |open class KotlinClass : JavaClass() { }
+ """.trimIndent(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ writerPlugin.writer.renderedContent("root/test/-kotlin-class/index.html").let { kotlinClassContent ->
+ val signatures = kotlinClassContent.signature().toList()
+ assertEquals(3, signatures.size, "Expected 2 signatures: class signature, constructor and property")
+
+ val property = signatures[2]
+ property.match(
+ "var ", A("property"), ":", A("Int"), Span(),
+ ignoreSpanWithTokenStyle = true
+ )
+ }
+
+ writerPlugin.writer.renderedContent("root/test/-java-class/index.html").let { kotlinClassContent ->
+ val signatures = kotlinClassContent.signature().toList()
+ assertEquals(2, signatures.size, "Expected 2 signatures: class signature and property")
+
+ val property = signatures[1]
+ property.match(
+ "open var ", A("property"), ":", A("Int"), Span(),
+ ignoreSpanWithTokenStyle = true
+ )
+ }
+ }
+ }
+ }
}