diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-29 19:41:55 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-29 19:41:55 +0000 |
commit | ddaa9be9783928ecd802c433821fe7c8e05bf8b9 (patch) | |
tree | 337f50329be1ff6925bbb2458d37cc5a11d0201a /clang/unittests/Format/FormatTest.cpp | |
parent | 9a7a7a9a6f81baa36cf9456da3d30d2a544ee64a (diff) | |
download | bcm5719-llvm-ddaa9be9783928ecd802c433821fe7c8e05bf8b9.tar.gz bcm5719-llvm-ddaa9be9783928ecd802c433821fe7c8e05bf8b9.zip |
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).
llvm-svn: 173821
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 219d73c04d6..32b2ff7f750 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/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) { |