Patch by Mathieu Champlon. Thank you.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239900
91177308-0d34-0410-b5e6-
96231b3b80d8
// Calculate the start of the non-whitespace text in the current line.
size_t StartOfLine = Lines[LineIndex].find_first_not_of(Blanks);
if (StartOfLine == StringRef::npos)
- StartOfLine = Lines[LineIndex].size();
+ StartOfLine = Lines[LineIndex].rtrim("\r\n").size();
StringRef Whitespace = Lines[LineIndex].substr(0, StartOfLine);
// Adjust Lines to only contain relevant text.
" f();\n"
"}"));
EXPECT_EQ(0, ReplacementCount);
+ EXPECT_EQ("/*\r\n"
+ "\r\n"
+ "*/\r\n",
+ format("/*\r\n"
+ "\r\n"
+ "*/\r\n"));
+ EXPECT_EQ(0, ReplacementCount);
}
TEST_F(FormatTest, RemovesEmptyLines) {