aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestComments.cpp
diff options
context:
space:
mode:
authorMarek Kurdej <marek.kurdej+llvm.org@gmail.com>2022-03-01 09:42:28 +0100
committerMarek Kurdej <marek.kurdej+llvm.org@gmail.com>2022-03-13 21:56:22 +0100
commit36d13d3f8adb3d1a6bae71370afa23d11a94dc78 (patch)
treea748b2e0af19cb012b917e620b835a1bf2f9ff03 /clang/unittests/Format/FormatTestComments.cpp
parent596fa2d90044841c33b9a0e6b17406c2a45077a2 (diff)
downloadllvm-36d13d3f8adb3d1a6bae71370afa23d11a94dc78.zip
llvm-36d13d3f8adb3d1a6bae71370afa23d11a94dc78.tar.gz
llvm-36d13d3f8adb3d1a6bae71370afa23d11a94dc78.tar.bz2
[clang-format] Add space to comments starting with '#'.
Fixes https://github.com/llvm/llvm-project/issues/35116. Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan Differential Revision: https://reviews.llvm.org/D121451
Diffstat (limited to 'clang/unittests/Format/FormatTestComments.cpp')
-rw-r--r--clang/unittests/Format/FormatTestComments.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp
index f83ffb3..27cc601 100644
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -91,6 +91,9 @@ TEST_F(FormatTestComments, UnderstandsSingleLineComments) {
"// line 2\n"
"void f() {}\n");
+ EXPECT_EQ("// comment\n", format("//comment\n"));
+ EXPECT_EQ("// #comment\n", format("//#comment\n"));
+
EXPECT_EQ("// comment\n"
"// clang-format on\n",
format("//comment\n"
@@ -3302,6 +3305,7 @@ TEST_F(FormatTestComments, SpaceAtLineCommentBegin) {
format(NoTextInComment, Style));
Style.SpacesInLineCommentPrefix.Minimum = 0;
+ EXPECT_EQ("//#comment", format("//#comment", Style));
EXPECT_EQ("//\n"
"\n"
"void foo() { //\n"
@@ -3310,6 +3314,7 @@ TEST_F(FormatTestComments, SpaceAtLineCommentBegin) {
format(NoTextInComment, Style));
Style.SpacesInLineCommentPrefix.Minimum = 5;
+ EXPECT_EQ("// #comment", format("//#comment", Style));
EXPECT_EQ("//\n"
"\n"
"void foo() { //\n"
@@ -3463,6 +3468,7 @@ TEST_F(FormatTestComments, SpaceAtLineCommentBegin) {
format(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"