diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-13 16:10:20 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-13 16:10:20 +0000 |
commit | 487f64b2ae3f991216eb1346a62ea18156f0b519 (patch) | |
tree | de0cb69a627145f39c9116c8c5c2324a99b96291 /unittests/Format/FormatTest.cpp | |
parent | a5bec298d96f7eb5309df5aab9d19eb7f8b75a81 (diff) |
Stronger respect the input codes line breaks wrt. comments.
clang-format should not change whether or not there is a line break
before a line comment as this strongly influences the percieved binding.
User input: void f(int a,
// b is awesome
int b);
void g(int a, // a is awesome
int b);
Before: void f(int a, // b is awesome
int b);
void g(int a, // a is awesome
int b);
After: <unchanged from input>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-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 f3da5061f2..a8417f1efd 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -285,6 +285,14 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) { verifyFormat("void f() {\n" " // Doesn't do anything\n" "}"); + verifyFormat("void f(int i, // some comment (probably for i)\n" + " int j, // some comment (probably for j)\n" + " int k); // some comment (probably for k)"); + verifyFormat("void f(int i,\n" + " // some comment (probably for j)\n" + " int j,\n" + " // some comment (probably for k)\n" + " int k);"); verifyFormat("int i // This is a fancy variable\n" " = 5;"); |