diff --git a/editorconfig-linters/src/test/java/org/ec4j/linters/TextLinterTest.java b/editorconfig-linters/src/test/java/org/ec4j/linters/TextLinterTest.java index ec00d8e..08b7168 100644 --- a/editorconfig-linters/src/test/java/org/ec4j/linters/TextLinterTest.java +++ b/editorconfig-linters/src/test/java/org/ec4j/linters/TextLinterTest.java @@ -134,6 +134,32 @@ public void insert_final_newline() throws IOException { PropertyType.insert_final_newline.getName(), "true")); } + @Test + public void insert_final_newline_system_eol() throws IOException { + final ResourceProperties props = ResourceProperties.builder() // + .property(new Property.Builder(null).type(PropertyType.insert_final_newline).value("true").build()) // + .property(new Property.Builder(null).type(PropertyType.trim_trailing_whitespace).value("true").build()) // + .build(); + String text = + "line 1" + System.lineSeparator() + // + "line 2 " + System.lineSeparator() + // + "line 3"// + ; + String expectedText = + "line 1" + System.lineSeparator() + // + "line 2" + System.lineSeparator() + // + "line 3" + System.lineSeparator() // + ; + Resource doc = LinterTestUtils.createDocument(text, ".txt"); + + LinterTestUtils.assertParse(linter, doc, expectedText, props, // + new Violation(doc, new Location(2, 7), new Delete(4), linter, + PropertyType.trim_trailing_whitespace.getName(), "true"), + new Violation(doc, new Location(3, 7), + Insert.endOfLine(EndOfLineValue.ofEndOfLineString(System.lineSeparator())), linter, + PropertyType.insert_final_newline.getName(), "true")); + } + @Test public void insert_final_newline_empty() throws IOException { final ResourceProperties props = ResourceProperties.builder() //