Skip to content

Commit ee69ec5

Browse files
committed
[tests] Migrate formatter tests to file-based cases
* Replace `FormatterTest` and `GoogleStyleFormatterKtTest` with file-based cases under cases/ * Move parse-error tests from `FormatterTest` to `ParserTest`
1 parent d7a0277 commit ee69ec5

628 files changed

Lines changed: 7402 additions & 11704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.jetbrains.ktfmt.format
2+
3+
import org.jetbrains.ktfmt.testutil.FormatterTestFactory
4+
import org.junit.jupiter.api.Assertions.assertEquals
5+
import org.junit.jupiter.api.Test
6+
7+
// core/src/test/resources/cases/format
8+
class FormatTest : FormatterTestFactory() {
9+
@Test
10+
fun `preserve LF, CRLF and CR line endings`() {
11+
val lines = listOf("fun main() {", " println(\"test\")", "}")
12+
for (ending in listOf("\n", "\r\n", "\r")) {
13+
val code = lines.joinToString(ending, postfix = ending)
14+
15+
val reformatted = Formatter.format(DEFAULT_CASE_FORMAT, code)
16+
assertEquals(code, reformatted)
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)