================
@@ -3991,224 +3988,224 @@ TEST_F(FormatTestComments, SpaceAtLineCommentBegin) {
"//vv will only move\n"
"//} if the line above does";
- EXPECT_EQ("// Free comment without space\n"
- "\n"
- "// Free comment with 3 spaces\n"
- "\n"
- "/// Free Doxygen without space\n"
- "\n"
- "/// Free Doxygen with 3 spaces\n"
- "\n"
- "// π A nice dragon\n"
- "\n"
- "//\t abccba\n"
- "\n"
- "//\\t deffed\n"
- "\n"
- "// π Another nice dragon\n"
- "\n"
- "// \t Three leading spaces following tab\n"
- "\n"
- "// \\t Three leading spaces following backslash\n"
- "\n"
- "/// A Doxygen Comment with a nested list:\n"
- "/// - Foo\n"
- "/// - Bar\n"
- "/// - Baz\n"
- "/// - End\n"
- "/// of the inner list\n"
- "/// .\n"
- "/// .\n"
- "\n"
- "namespace Foo {\n"
- "bool bar(bool b) {\n"
- " bool ret1 = true; ///< Doxygenstyle without space\n"
- " bool ret2 = true; ///< Doxygenstyle with 3 spaces\n"
- " if (b) {\n"
- " // Foo\n"
- "\n"
- " // In function comment\n"
- " ret2 = false;\n"
- " } // End of if\n"
- "\n"
- " // if (ret1) {\n"
- " // return ret2;\n"
- " // }\n"
- "\n"
- " // if (ret1) {\n"
- " // return ret2;\n"
- " // }\n"
- "\n"
- " return ret1 && ret2;\n"
- "}\n"
- "} // namespace Foo\n"
- "\n"
- "namespace Bar {\n"
- "int foo();\n"
- "} // namespace Bar\n"
- "//@Nothing added because of the non ascii char\n"
- "\n"
- "//@ Nothing removed because of the non ascii char\n"
- "\n"
- "// Comment to move to the left\n"
- "// But not this?\n"
- "// @but this\n"
- "\n"
- "// Comment to move to the right\n"
- "//@ this stays\n"
- "\n"
- "//} will not move\n"
- "\n"
- "// vv will only move\n"
- "// } if the line above does",
- format(Code, Style));
+ verifyFormat("// Free comment without space\n"
+ "\n"
+ "// Free comment with 3 spaces\n"
+ "\n"
+ "/// Free Doxygen without space\n"
+ "\n"
+ "/// Free Doxygen with 3 spaces\n"
+ "\n"
+ "// π A nice dragon\n"
+ "\n"
+ "//\t abccba\n"
+ "\n"
+ "//\\t deffed\n"
+ "\n"
+ "// π Another nice dragon\n"
+ "\n"
+ "// \t Three leading spaces following tab\n"
+ "\n"
+ "// \\t Three leading spaces following backslash\n"
+ "\n"
+ "/// A Doxygen Comment with a nested list:\n"
+ "/// - Foo\n"
+ "/// - Bar\n"
+ "/// - Baz\n"
+ "/// - End\n"
+ "/// of the inner list\n"
+ "/// .\n"
+ "/// .\n"
+ "\n"
+ "namespace Foo {\n"
+ "bool bar(bool b) {\n"
+ " bool ret1 = true; ///< Doxygenstyle without space\n"
+ " bool ret2 = true; ///< Doxygenstyle with 3 spaces\n"
+ " if (b) {\n"
+ " // Foo\n"
+ "\n"
+ " // In function comment\n"
+ " ret2 = false;\n"
+ " } // End of if\n"
+ "\n"
+ " // if (ret1) {\n"
+ " // return ret2;\n"
+ " // }\n"
+ "\n"
+ " // if (ret1) {\n"
+ " // return ret2;\n"
+ " // }\n"
+ "\n"
+ " return ret1 && ret2;\n"
+ "}\n"
+ "} // namespace Foo\n"
+ "\n"
+ "namespace Bar {\n"
+ "int foo();\n"
+ "} // namespace Bar\n"
+ "//@Nothing added because of the non ascii char\n"
+ "\n"
+ "//@ Nothing removed because of the non ascii char\n"
+ "\n"
+ "// Comment to move to the left\n"
+ "// But not this?\n"
+ "// @but this\n"
+ "\n"
+ "// Comment to move to the right\n"
+ "//@ this stays\n"
+ "\n"
+ "//} will not move\n"
+ "\n"
+ "// vv will only move\n"
+ "// } if the line above does",
+ Code, Style);
Style.SpacesInLineCommentPrefix = {0, 0};
- EXPECT_EQ("//#comment", format("// #comment", Style));
- EXPECT_EQ("//Free comment without space\n"
- "\n"
- "//Free comment with 3 spaces\n"
- "\n"
- "///Free Doxygen without space\n"
- "\n"
- "///Free Doxygen with 3 spaces\n"
- "\n"
- "//π A nice dragon\n"
- "\n"
- "//\t abccba\n"
- "\n"
- "//\\t deffed\n"
- "\n"
- "//π Another nice dragon\n"
- "\n"
- "//\t Three leading spaces following tab\n"
- "\n"
- "//\\t Three leading spaces following backslash\n"
- "\n"
- "///A Doxygen Comment with a nested list:\n"
- "///- Foo\n"
- "///- Bar\n"
- "/// - Baz\n" // Here we keep the relative indentation
- "/// - End\n"
- "/// of the inner list\n"
- "/// .\n"
- "///.\n"
- "\n"
- "namespace Foo {\n"
- "bool bar(bool b) {\n"
- " bool ret1 = true; ///<Doxygenstyle without space\n"
- " bool ret2 = true; ///<Doxygenstyle with 3 spaces\n"
- " if (b) {\n"
- " //Foo\n"
- "\n"
- " //In function comment\n"
- " ret2 = false;\n"
- " } //End of if\n"
- "\n"
- " //if (ret1) {\n"
- " // return ret2;\n"
- " //}\n"
- "\n"
- " //if (ret1) {\n"
- " // return ret2;\n"
- " //}\n"
- "\n"
- " return ret1 && ret2;\n"
- "}\n"
- "} //namespace Foo\n"
- "\n"
- "namespace Bar {\n"
- "int foo();\n"
- "} //namespace Bar\n"
- "//@Nothing added because of the non ascii char\n"
- "\n"
- "//@ Nothing removed because of the non ascii char\n"
- "\n"
- "//Comment to move to the left\n"
- "//But not this?\n"
- "//@but this\n"
- "\n"
- "//Comment to move to the right\n"
- "//@ this stays\n"
- "\n"
- "//} will not move\n"
- "\n"
- "//vv will only move\n"
- "//} if the line above does",
- format(Code, Style));
+ verifyFormat("//#comment", "// #comment", Style);
+ verifyFormat("//Free comment without space\n"
+ "\n"
+ "//Free comment with 3 spaces\n"
+ "\n"
+ "///Free Doxygen without space\n"
+ "\n"
+ "///Free Doxygen with 3 spaces\n"
+ "\n"
+ "//π A nice dragon\n"
+ "\n"
+ "//\t abccba\n"
+ "\n"
+ "//\\t deffed\n"
+ "\n"
+ "//π Another nice dragon\n"
+ "\n"
+ "//\t Three leading spaces following tab\n"
+ "\n"
+ "//\\t Three leading spaces following backslash\n"
+ "\n"
+ "///A Doxygen Comment with a nested list:\n"
+ "///- Foo\n"
+ "///- Bar\n"
+ "/// - Baz\n" // Here we keep the relative indentation
+ "/// - End\n"
+ "/// of the inner list\n"
+ "/// .\n"
+ "///.\n"
+ "\n"
+ "namespace Foo {\n"
+ "bool bar(bool b) {\n"
+ " bool ret1 = true; ///<Doxygenstyle without space\n"
+ " bool ret2 = true; ///<Doxygenstyle with 3 spaces\n"
+ " if (b) {\n"
+ " //Foo\n"
+ "\n"
+ " //In function comment\n"
+ " ret2 = false;\n"
+ " } //End of if\n"
+ "\n"
+ " //if (ret1) {\n"
+ " // return ret2;\n"
+ " //}\n"
+ "\n"
+ " //if (ret1) {\n"
+ " // return ret2;\n"
+ " //}\n"
+ "\n"
+ " return ret1 && ret2;\n"
+ "}\n"
+ "} //namespace Foo\n"
+ "\n"
+ "namespace Bar {\n"
+ "int foo();\n"
+ "} //namespace Bar\n"
+ "//@Nothing added because of the non ascii char\n"
+ "\n"
+ "//@ Nothing removed because of the non ascii char\n"
+ "\n"
+ "//Comment to move to the left\n"
+ "//But not this?\n"
+ "//@but this\n"
+ "\n"
+ "//Comment to move to the right\n"
+ "//@ this stays\n"
+ "\n"
+ "//} will not move\n"
+ "\n"
+ "//vv will only move\n"
+ "//} if the line above does",
+ Code, Style);
----------------
owenca wrote:
`verifyFormat(Code3, Code, Style);`
https://github.com/llvm/llvm-project/pull/164310
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits