summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-04-19 13:02:15 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-04-19 13:02:15 +0000
commit621030523b0e57672979c495778ba8f13d86afa4 (patch)
tree5a6cb6c351904c1ac4b8a2f0c7959011d854ffef /clang/unittests/Format/FormatTest.cpp
parentd96ddccdb4e6c74e727d97cb811e400b15ab32f7 (diff)
downloadbcm5719-llvm-621030523b0e57672979c495778ba8f13d86afa4.tar.gz
bcm5719-llvm-621030523b0e57672979c495778ba8f13d86afa4.zip
[clang-format] Don't remove empty lines before namespace endings
Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45373 llvm-svn: 330324
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 4397cdfe692..ddaa5cae463 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -278,11 +278,12 @@ TEST_F(FormatTest, RemovesEmptyLines) {
"\n"
"}"));
- // FIXME: This is slightly inconsistent.
+ // Don't remove empty lines before namespace endings.
FormatStyle LLVMWithNoNamespaceFix = getLLVMStyle();
LLVMWithNoNamespaceFix.FixNamespaceComments = false;
EXPECT_EQ("namespace {\n"
"int i;\n"
+ "\n"
"}",
format("namespace {\n"
"int i;\n"
@@ -293,6 +294,27 @@ TEST_F(FormatTest, RemovesEmptyLines) {
"}",
format("namespace {\n"
"int i;\n"
+ "}", LLVMWithNoNamespaceFix));
+ EXPECT_EQ("namespace {\n"
+ "int i;\n"
+ "\n"
+ "};",
+ format("namespace {\n"
+ "int i;\n"
+ "\n"
+ "};", LLVMWithNoNamespaceFix));
+ EXPECT_EQ("namespace {\n"
+ "int i;\n"
+ "};",
+ format("namespace {\n"
+ "int i;\n"
+ "};", LLVMWithNoNamespaceFix));
+ EXPECT_EQ("namespace {\n"
+ "int i;\n"
+ "\n"
+ "}",
+ format("namespace {\n"
+ "int i;\n"
"\n"
"}"));
EXPECT_EQ("namespace {\n"
OpenPOWER on IntegriCloud