summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/CleanupTest.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2016-10-05 15:49:01 +0000
committerEric Liu <ioeric@google.com>2016-10-05 15:49:01 +0000
commit7956c4004db510e20d23a4e87d1cc1d00c14902c (patch)
tree8d4ee3b2abf7b3405c26c371d5d3fce1e54b50cb /clang/unittests/Format/CleanupTest.cpp
parent67be6ff8392a20dad2a02df12151e62d13b34a24 (diff)
downloadbcm5719-llvm-7956c4004db510e20d23a4e87d1cc1d00c14902c.tar.gz
bcm5719-llvm-7956c4004db510e20d23a4e87d1cc1d00c14902c.zip
Make DeletedLines local variables in checkEmptyNamespace.
Summary: Patch by Sam McCall! Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D25162 llvm-svn: 283332
Diffstat (limited to 'clang/unittests/Format/CleanupTest.cpp')
-rw-r--r--clang/unittests/Format/CleanupTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/Format/CleanupTest.cpp b/clang/unittests/Format/CleanupTest.cpp
index 25fa9539f2b..77c4d9be81a 100644
--- a/clang/unittests/Format/CleanupTest.cpp
+++ b/clang/unittests/Format/CleanupTest.cpp
@@ -119,6 +119,24 @@ TEST_F(CleanupTest, EmptyNamespaceWithCommentsBreakBeforeBrace) {
EXPECT_EQ(Expected, Result);
}
+TEST_F(CleanupTest, EmptyNamespaceAroundConditionalCompilation) {
+ std::string Code = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n"
+ "namespace {}";
+ std::string Expected = "#ifdef A\n"
+ "int a;\n"
+ "int b;\n"
+ "#else\n"
+ "#endif\n";
+ std::vector<tooling::Range> Ranges(1, tooling::Range(0, Code.size()));
+ FormatStyle Style = getLLVMStyle();
+ std::string Result = cleanup(Code, Ranges, Style);
+ EXPECT_EQ(Expected, Result);
+}
+
TEST_F(CleanupTest, CtorInitializationSimpleRedundantComma) {
std::string Code = "class A {\nA() : , {} };";
std::string Expected = "class A {\nA() {} };";
OpenPOWER on IntegriCloud