aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt')
-rw-r--r--core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt52
1 files changed, 52 insertions, 0 deletions
diff --git a/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt b/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt
index 88b16fe..ae9d05e 100644
--- a/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt
+++ b/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt
@@ -446,6 +446,58 @@ class FormatterTest {
.trimMargin())
@Test
+ fun `properties with line comment above initializer`() =
+ assertFormatted(
+ """
+ |class Foo {
+ | var x: Int =
+ | // Comment
+ | 0
+ |
+ | var y: Int =
+ | // Comment
+ | scope {
+ | 0 //
+ | }
+ |
+ | var z: Int =
+ | // Comment
+ | if (cond) {
+ | 0
+ | } else {
+ | 1
+ | }
+ |}
+ |"""
+ .trimMargin())
+
+ @Test
+ fun `properties with line comment above delegate`() =
+ assertFormatted(
+ """
+ |class Foo {
+ | var x: Int by
+ | // Comment
+ | 0
+ |
+ | var y: Int by
+ | // Comment
+ | scope {
+ | 0 //
+ | }
+ |
+ | var z: Int by
+ | // Comment
+ | if (cond) {
+ | 0
+ | } else {
+ | 1
+ | }
+ |}
+ |"""
+ .trimMargin())
+
+ @Test
fun `properties with accessors`() =
assertFormatted(
"""