diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-24 06:33:59 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-24 06:33:59 +0000 |
commit | af8497681e38106ad6f84408e029537e2a13d79d (patch) | |
tree | a5dc54db9377b7a60d54e014d9bc0bf62515bc48 /unittests | |
parent | 44f72d34a947c654f88ea212b7fe5834615bca11 (diff) |
Fix comment alignment behavior.
In the following snippet, clang-format incorrectly aligned the
trailing comment, when only the last line was formatted:
int aaaaaa; // comment
int b;
int c; // Formatting only this line moved this comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 0095d58c6b..97539d91a6 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -621,6 +621,13 @@ TEST_F(FormatTest, CanFormatCommentsLocally) { " // line 2\n" "int b;", 28, 0, getLLVMStyle())); + EXPECT_EQ("int aaaaaa; // comment\n" + "int b;\n" + "int c; // unrelated comment", + format("int aaaaaa; // comment\n" + "int b;\n" + "int c; // unrelated comment", + 31, 0, getLLVMStyle())); } TEST_F(FormatTest, RemovesTrailingWhitespaceOfComments) { |