Indent all lines in a multi-line comment by the same amount.
Summary:
Do this to avoid spoling nicely formatted multi-line comments (e.g.
with code examples or similar stuff).
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D544
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177153 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index ca7ed62..4034d1a 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -619,14 +619,6 @@
" * comment.\n"
" */\n"
" void f() {}"));
- EXPECT_EQ("/*\n"
- " A comment.\n"
- " */\n"
- "void f() {}",
- format(" /*\n"
- " A comment.\n"
- " */\n"
- " void f() {}"));
EXPECT_EQ("class C {\n"
" /*\n"
" * Another multi-line\n"
@@ -641,6 +633,22 @@
" */\n"
"void f() {}\n"
"};"));
+ EXPECT_EQ("/*\n"
+ " 1. This is a comment with non-trivial formatting.\n"
+ " 1.1. We have to indent/outdent all lines equally\n"
+ " 1.1.1. to keep the formatting.\n"
+ " */",
+ format(" /*\n"
+ " 1. This is a comment with non-trivial formatting.\n"
+ " 1.1. We have to indent/outdent all lines equally\n"
+ " 1.1.1. to keep the formatting.\n"
+ " */"));
+ EXPECT_EQ("/*\n"
+ " Don't try to outdent if there's not enough inentation.\n"
+ " */",
+ format(" /*\n"
+ " Don't try to outdent if there's not enough inentation.\n"
+ " */"));
}
TEST_F(FormatTest, CommentsInStaticInitializers) {