|
@@ -159,9 +159,21 @@ TEST_F(FormatTest, FormatsCorrectRegionForLeadingWhitespace) {
|
|
|
25, 0, getLLVMStyleWithColumns(12)));
|
|
|
}
|
|
|
|
|
|
+TEST_F(FormatTest, FormatLineWhenInvokedOnTrailingNewline) {
|
|
|
+ EXPECT_EQ("int b;\n\nint a;",
|
|
|
+ format("int b;\n\nint a;", 8, 0, getLLVMStyle()));
|
|
|
+ EXPECT_EQ("int b;\n\nint a;",
|
|
|
+ format("int b;\n\nint a;", 7, 0, getLLVMStyle()));
|
|
|
+
|
|
|
+ // This might not strictly be correct, but is likely good in all practical
|
|
|
+ // cases.
|
|
|
+ EXPECT_EQ("int b;\nint a;",
|
|
|
+ format("int b;int a;", 7, 0, getLLVMStyle()));
|
|
|
+}
|
|
|
+
|
|
|
TEST_F(FormatTest, RemovesWhitespaceWhenTriggeredOnEmptyLine) {
|
|
|
EXPECT_EQ("int a;\n\n int b;",
|
|
|
- format("int a;\n \n\n int b;", 7, 0, getLLVMStyle()));
|
|
|
+ format("int a;\n \n\n int b;", 8, 0, getLLVMStyle()));
|
|
|
EXPECT_EQ("int a;\n\n int b;",
|
|
|
format("int a;\n \n\n int b;", 9, 0, getLLVMStyle()));
|
|
|
}
|