summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-03-15 13:42:02 +0000
committerAlexander Kornienko <alexfh@google.com>2013-03-15 13:42:02 +0000
commit79d6c72e0ede4ab816c46727326985d6547f826b (patch)
tree87fcee4d7b1eec8574335bbb4c36ea656b2954a0 /clang/unittests/Format/FormatTest.cpp
parentb0fac42987600989a477a1e09e29ee10ca4ed5b7 (diff)
downloadbcm5719-llvm-79d6c72e0ede4ab816c46727326985d6547f826b.tar.gz
bcm5719-llvm-79d6c72e0ede4ab816c46727326985d6547f826b.zip
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 llvm-svn: 177153
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index ca7ed62ed1e..4034d1a7b80 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -619,14 +619,6 @@ TEST_F(FormatTest, AlignsMultiLineComments) {
" * 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 @@ TEST_F(FormatTest, AlignsMultiLineComments) {
" */\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) {
OpenPOWER on IntegriCloud