summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-02-03 10:18:25 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-02-03 10:18:25 +0000
commitd105b72df64ed394b6fb98c13467a2096c1b68e7 (patch)
tree742034f2130e14cc5f16c1c9824442da78c9134b /clang/unittests/Format/FormatTest.cpp
parent82c489f2a6c73dbe1391954d422ffd9bbdc2dab9 (diff)
downloadbcm5719-llvm-d105b72df64ed394b6fb98c13467a2096c1b68e7.tar.gz
bcm5719-llvm-d105b72df64ed394b6fb98c13467a2096c1b68e7.zip
[clang-format] Re-align broken comment lines where appropriate.
Summary: The comment aligner was skipping over newly broken comment lines. This patch fixes that. source: ``` int ab; // line int a; // long long ``` format with column limit 15 before: ``` int ab; // line int a; // long // long ``` format with column limit 15 after: ``` int ab; // line int a; // long // long ``` Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D29486 llvm-svn: 293997
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index d9f56e38f84..6cc9d1979fa 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -11852,6 +11852,40 @@ TEST_F(FormatTest, AlignTrailingComments) {
" // line 3\n"
" b);",
getLLVMStyleWithColumns(40)));
+
+ // Align newly broken trailing comments.
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n",
+ format("int ab; // line\n"
+ "int a; // long long\n",
+ getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n"
+ " // long",
+ format("int ab; // line\n"
+ "int a; // long long\n"
+ " // long",
+ getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n"
+ "pt c; // long",
+ format("int ab; // line\n"
+ "int a; // long long\n"
+ "pt c; // long",
+ getLLVMStyleWithColumns(15)));
+ EXPECT_EQ("int ab; // line\n"
+ "int a; // long\n"
+ " // long\n"
+ "\n"
+ "// long",
+ format("int ab; // line\n"
+ "int a; // long long\n"
+ "\n"
+ "// long",
+ getLLVMStyleWithColumns(15)));
}
} // end namespace
} // end namespace format
OpenPOWER on IntegriCloud