| package com.github.shyiko.ktlint.ruleset.standard |
| |
| import com.github.shyiko.ktlint.core.LintError |
| import com.github.shyiko.ktlint.test.format |
| import com.github.shyiko.ktlint.test.lint |
| import org.assertj.core.api.Assertions.assertThat |
| import org.testng.annotations.Test |
| |
| class NoTrailingSpacesRuleTest { |
| |
| @Test |
| fun testLint() { |
| assertThat(NoTrailingSpacesRule().lint("fun main() {\n val a = 1\n\n \n} ")) |
| .isEqualTo(listOf( |
| LintError(4, 1, "no-trailing-spaces", "Trailing space(s)"), |
| LintError(5, 2, "no-trailing-spaces", "Trailing space(s)") |
| )) |
| } |
| |
| @Test |
| fun testFormat() { |
| assertThat(NoTrailingSpacesRule().format("fun main() {\n val a = 1 \n \n \n} ")) |
| .isEqualTo("fun main() {\n val a = 1\n\n\n}") |
| } |
| } |