aboutsummaryrefslogtreecommitdiff
path: root/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt')
-rw-r--r--ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt28
1 files changed, 27 insertions, 1 deletions
diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt
index cc71781f..e0bcb9cc 100644
--- a/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt
+++ b/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/SpacingAroundCommaRuleTest.kt
@@ -23,12 +23,38 @@ class SpacingAroundCommaRuleTest {
)).isEqualTo(listOf(
LintError(2, 10, "comma-spacing", "Missing spacing after \",\"")
))
+ assertThat(SpacingAroundCommaRule().lint(
+ """
+ some.method(1 , 2)
+ """.trimIndent(),
+ script = true
+ )).isEqualTo(listOf(
+ LintError(1, 14, "comma-spacing", "Unexpected spacing before \",\"")
+ ))
}
@Test
fun testFormat() {
assertThat(SpacingAroundCommaRule().format("fun main() { x(1,3); x(1, 3) }"))
.isEqualTo("fun main() { x(1, 3); x(1, 3) }")
+ assertThat(SpacingAroundCommaRule().format(
+ """
+ fun fn(
+ arg1: Int ,
+ arg2: Int
+ ,
+
+ arg3: Int
+ ) = Unit
+ """.trimIndent()
+ )).isEqualTo(
+ """
+ fun fn(
+ arg1: Int,
+ arg2: Int,
+
+ arg3: Int
+ ) = Unit
+ """.trimIndent())
}
}
-