aboutsummaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-29 19:41:55 +0000
committerDaniel Jasper <djasper@google.com>2013-01-29 19:41:55 +0000
commitd4f2c2e21addd8ed0a50b92f062d3229cde0506a (patch)
tree35927ab800fbda655d8909c9f055841b0fbeb39b /unittests/Format/FormatTest.cpp
parent3d207e76a1c7ece5deec3d6ee35af04fe7f6212e (diff)
Improve formatting of code with comments.
Before: aaaaaaa(aaaaaa( // comment aaaaaaa)); <big mess> After: aaaaaaa(aaaaaa( // comment aaaaaaaa)); function(/* parameter 1 */ aaaaaaa, /* parameter 2 */ aaaaaaa, /* parameter 3 */ aaaaaaa, /* parameter 4 */ aaaaaaa); (the latter example was only wrong in the one-arg-per-line mode, e.g. in Google style). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 219d73c04d..32b2ff7f75 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -447,6 +447,9 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) {
format("int i;\\\n// single line trailing comment"));
verifyGoogleFormat("int a; // Trailing comment.");
+
+ verifyFormat("someFunction(anotherFunction( // Force break.\n"
+ " parameter));");
}
TEST_F(FormatTest, UnderstandsMultiLineComments) {
@@ -461,6 +464,11 @@ TEST_F(FormatTest, UnderstandsMultiLineComments) {
" /* Leading comment for bb... */ bbbbbbbbbbbbbbbbbbbbbbbbb);",
format("f(aaaaaaaaaaaaaaaaaaaaaaaaa , \n"
"/* Leading comment for bb... */ bbbbbbbbbbbbbbbbbbbbbbbbb);"));
+
+ verifyGoogleFormat("aaaaaaaa(/* parameter 1 */ aaaaaa,\n"
+ " /* parameter 2 */ aaaaaa,\n"
+ " /* parameter 3 */ aaaaaa,\n"
+ " /* parameter 4 */ aaaaaa);");
}
TEST_F(FormatTest, CommentsInStaticInitializers) {