r297034 - [clang-format] Add tests for ambiguous namespaces to the comment fixer
Krasimir Georgiev via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 6 09:29:25 PST 2017
Author: krasimir
Date: Mon Mar 6 11:29:25 2017
New Revision: 297034
URL: http://llvm.org/viewvc/llvm-project?rev=297034&view=rev
Log:
[clang-format] Add tests for ambiguous namespaces to the comment fixer
Modified:
cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
Modified: cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp?rev=297034&r1=297033&r2=297034&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp (original)
+++ cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp Mon Mar 6 11:29:25 2017
@@ -406,6 +406,86 @@ TEST_F(NamespaceEndCommentsFixerTest,
"#else\n"
" int j;\n"
"#endif"));
+ EXPECT_EQ("#if A\n"
+ "namespace A {\n"
+ "#else\n"
+ "namespace B {\n"
+ "#endif\n"
+ "int i;\n"
+ "int j;\n"
+ "}",
+ fixNamespaceEndComments("#if A\n"
+ "namespace A {\n"
+ "#else\n"
+ "namespace B {\n"
+ "#endif\n"
+ "int i;\n"
+ "int j;\n"
+ "}"));
+ EXPECT_EQ("#if A\n"
+ "namespace A {\n"
+ "#else\n"
+ "namespace B {\n"
+ "#endif\n"
+ "int i;\n"
+ "int j;\n"
+ "} // namespace A",
+ fixNamespaceEndComments("#if A\n"
+ "namespace A {\n"
+ "#else\n"
+ "namespace B {\n"
+ "#endif\n"
+ "int i;\n"
+ "int j;\n"
+ "} // namespace A"));
+ EXPECT_EQ("#if A\n"
+ "namespace A {\n"
+ "#else\n"
+ "namespace B {\n"
+ "#endif\n"
+ "int i;\n"
+ "int j;\n"
+ "} // namespace B",
+ fixNamespaceEndComments("#if A\n"
+ "namespace A {\n"
+ "#else\n"
+ "namespace B {\n"
+ "#endif\n"
+ "int i;\n"
+ "int j;\n"
+ "} // namespace B"));
+ EXPECT_EQ("namespace A\n"
+ "int i;\n"
+ "int j;\n"
+ "#if A\n"
+ "}\n"
+ "#else\n"
+ "}\n"
+ "#endif",
+ fixNamespaceEndComments("namespace A\n"
+ "int i;\n"
+ "int j;\n"
+ "#if A\n"
+ "}\n"
+ "#else\n"
+ "}\n"
+ "#endif"));
+ EXPECT_EQ("namespace A\n"
+ "int i;\n"
+ "int j;\n"
+ "#if A\n"
+ "} // namespace A\n"
+ "#else\n"
+ "} // namespace A\n"
+ "#endif",
+ fixNamespaceEndComments("namespace A\n"
+ "int i;\n"
+ "int j;\n"
+ "#if A\n"
+ "} // namespace A\n"
+ "#else\n"
+ "} // namespace A\n"
+ "#endif"));
}
TEST_F(NamespaceEndCommentsFixerTest,
More information about the cfe-commits
mailing list