[clang-format] Add tests for ambiguous namespaces to the comment fixer

llvm-svn: 297034
This commit is contained in:
Krasimir Georgiev 2017-03-06 17:29:25 +00:00
parent 8a4c601abc
commit 615353cf38
1 changed files with 80 additions and 0 deletions

View File

@ -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,