summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index fcfe9778f3c..7221ec898aa 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1930,6 +1930,30 @@ TEST_F(FormatTest, SeparatesLogicalBlocks) {
"\n"
" void f();\n"
"};"));
+
+ // Even ensure proper spacing inside macros.
+ EXPECT_EQ("#define B \\\n"
+ " class A { \\\n"
+ " protected: \\\n"
+ " public: \\\n"
+ " void f(); \\\n"
+ " };",
+ format("#define B \\\n"
+ " class A { \\\n"
+ " protected: \\\n"
+ " \\\n"
+ " public: \\\n"
+ " \\\n"
+ " void f(); \\\n"
+ " };",
+ getGoogleStyle()));
+ // But don't remove empty lines after macros ending in access specifiers.
+ EXPECT_EQ("#define A private:\n"
+ "\n"
+ "int i;",
+ format("#define A private:\n"
+ "\n"
+ "int i;"));
}
TEST_F(FormatTest, FormatsClasses) {
OpenPOWER on IntegriCloud