aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-03-14 16:10:54 +0000
committerAlexander Kornienko <alexfh@google.com>2013-03-14 16:10:54 +0000
commitf753615897c86928517e48e4d106e669d59618c5 (patch)
treea0dce4f13a55008ecbb6f45c9dabf3b45324e9f6 /unittests/Format/FormatTest.cpp
parentbfa1edd8247b80e951a570ff2486fe5fa9898c41 (diff)
Multi-line comment alignment
Summary: Aligns continuation lines of multi-line comments to the base indentation level +1: class A { /* * test */ void f() {} }; The first revision is work in progress. The implementation is not yet complete. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D541 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177080 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 3044c69cd0..ca7ed62ed1 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -608,6 +608,41 @@ TEST_F(FormatTest, UnderstandsMultiLineComments) {
NoBinPacking);
}
+TEST_F(FormatTest, AlignsMultiLineComments) {
+ EXPECT_EQ("/*\n"
+ " * Really multi-line\n"
+ " * comment.\n"
+ " */\n"
+ "void f() {}",
+ format(" /*\n"
+ " * Really multi-line\n"
+ " * 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"
+ " * comment.\n"
+ " */\n"
+ " void f() {}\n"
+ "};",
+ format("class C {\n"
+ "/*\n"
+ " * Another multi-line\n"
+ " * comment.\n"
+ " */\n"
+ "void f() {}\n"
+ "};"));
+}
+
TEST_F(FormatTest, CommentsInStaticInitializers) {
EXPECT_EQ(
"static SomeType type = { aaaaaaaaaaaaaaaaaaaa, /* comment */\n"