diff options
author | Daniel Jasper <djasper@google.com> | 2013-10-25 14:29:37 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-10-25 14:29:37 +0000 |
commit | 47066e46b9ce4f830ead3c7b9a4cb5bf0ac2c857 (patch) | |
tree | e28949cdc69eb4a64d722e789b1ec54131eb94c6 /unittests | |
parent | 9d33c40838367ffcc3206a7120a0ce32922b66d8 (diff) | |
download | clang-47066e46b9ce4f830ead3c7b9a4cb5bf0ac2c857.tar.gz |
clang-format: Adapt line break penalties for LLVM style.
Specifically make clang-format less eager to break after the opening
parenthesis of a function call.
Before:
aaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
Apparently that is preferable. This penalties are adapted
conservatively, we might have to increase them a little bit further.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 431940938d..ac95f27b2f 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2973,9 +2973,9 @@ TEST_F(FormatTest, BreaksDesireably) { "aaaaaa(aaa, new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaa));"); verifyFormat( - "aaaaaaaaaaaaaaaaa(\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" - " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); + "aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); // Indent consistently indenpendent of call expression. verifyFormat("aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(\n" @@ -3122,7 +3122,7 @@ TEST_F(FormatTest, FormatsBuilderPattern) { " ->aaaaaaaaaaaaaaaa(\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n" " ->aaaaaaaaaaaaaaaaa();"); - verifyFormat( + verifyGoogleFormat( "someobj->Add((new util::filetools::Handler(dir))\n" " ->OnEvent1(NewPermanentCallback(\n" " this, &HandlerHolderClass::EventHandlerCBA))\n" @@ -4497,7 +4497,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) { NoSpaces); } -TEST_F(FormatTest, FormatsBracedListsinColumnLayout) { +TEST_F(FormatTest, FormatsBracedListsInColumnLayout) { verifyFormat("vector<int> x = { 1, 22, 333, 4444, 55555, 666666, 7777777,\n" " 1, 22, 333, 4444, 55555, 666666, 7777777,\n" " 1, 22, 333, 4444, 55555, 666666, 7777777,\n" @@ -4538,8 +4538,8 @@ TEST_F(FormatTest, FormatsBracedListsinColumnLayout) { verifyFormat("vector<int> x = { 1, 1, 1, 1,\n" " 1, 1, 1, 1, };", getLLVMStyleWithColumns(39)); - verifyFormat("vector<int> x = {\n" - " 1, 1, 1, 1, 1, 1, 1, 1, //\n" + verifyFormat("vector<int> x = { 1, 1, 1, 1,\n" + " 1, 1, 1, 1, //\n" "};", getLLVMStyleWithColumns(39)); verifyFormat("vector<int> x = { 1, 1, 1, 1,\n" @@ -6597,6 +6597,8 @@ TEST_F(FormatTest, ParsesConfiguration) { ConstructorInitializerIndentWidth, 1234u); CHECK_PARSE("ColumnLimit: 1234", ColumnLimit, 1234u); CHECK_PARSE("MaxEmptyLinesToKeep: 1234", MaxEmptyLinesToKeep, 1234u); + CHECK_PARSE("PenaltyBreakBeforeFirstCallParameter: 1234", + PenaltyBreakBeforeFirstCallParameter, 1234u); CHECK_PARSE("PenaltyExcessCharacter: 1234", PenaltyExcessCharacter, 1234u); CHECK_PARSE("PenaltyReturnTypeOnItsOwnLine: 1234", PenaltyReturnTypeOnItsOwnLine, 1234u); |