From 7956c4004db510e20d23a4e87d1cc1d00c14902c Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 5 Oct 2016 15:49:01 +0000 Subject: 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 --- clang/unittests/Format/CleanupTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'clang/unittests/Format/CleanupTest.cpp') 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 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() {} };"; -- cgit v1.2.3