diff options
author | Daniel Jasper <djasper@google.com> | 2015-01-07 14:00:11 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-01-07 14:00:11 +0000 |
commit | 143cd925d8c7da707013cb8a82afc1fa61186ee6 (patch) | |
tree | 2ac3961e0a9ff05fe3aee2ef43c0d4835a93fc79 /unittests | |
parent | 5f3321a2c1bffe97e88ea20c246b1acf54199247 (diff) |
clang-format: Understand single-line comments at the end of blocks.
This prevents clang-format from moving/aligning the comment in the
snippet:
void f() {
int i; // some comment
// some unrelated comment
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index a0f450338b..fc49bde714 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -998,6 +998,14 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) { " // first\n" "// at start\n" "otherLine();")); + EXPECT_EQ("void f() {\n" + " lineWith(); // comment\n" + " // at start\n" + "}", + format("void f() {\n" + " lineWith(); // comment\n" + " // at start\n" + "}")); verifyFormat( "#define A \\\n" |