================
@@ -332,6 +332,397 @@ TEST_F(FormatTestComments, UnderstandsSingleLineComments)
{
verifyNoCrash(StringRef("/*\\\0\n/", 6));
}
+TEST_F(FormatTestComments, InsertsSpaceAfterOpeningBlockComment) {
+ FormatStyle Style = getLLVMStyle();
+ Style.SpaceInComments.AfterOpeningComment =
+ FormatStyle::CommentSpaceMode::Always;
+
+ verifyFormat("foo(/* comment */);", "foo(/*comment */);", Style);
+ verifyFormat("/* comment */", "/*comment */", Style);
+ verifyFormat("/* comment before code */\n"
+ "int x;",
+ "/*comment before code */\n"
+ "int x;",
+ Style);
+ verifyFormat("/* \n"
+ "comment */",
+ "/*\n"
+ "comment */",
+ Style);
+ verifyFormat("/* \ncomment */\n"
+ "int x;",
+ "/*\ncomment */\n"
+ "int x;",
+ Style);
+ verifyFormat("/* \n"
+ "comment line\n"
+ "*/",
+ "/*\n"
+ "comment line\n"
+ "*/",
+ Style);
+ verifyFormat("/* \n"
+ " * comment star\n"
+ "*/",
+ "/*\n"
+ " * comment star\n"
+ "*/",
+ Style);
+ verifyFormat("/* comment line\n"
+ "next */",
+ "/*comment line\n"
+ "next */",
+ Style);
+ verifyFormat("/* */", "/* */", Style);
+ verifyFormat("/*\n*/", "/*\n*/", Style);
----------------
HazardyKnusperkeks wrote:
```suggestion
verifyFormat("/*\n"
"*/", "/*\n"
"*/", Style);
```
Please break after each `\n` in strings.
https://github.com/llvm/llvm-project/pull/162105
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits