aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/ConfigParseTest.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp18
2 files changed, 20 insertions, 0 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index 9746aa3..1078844 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -266,6 +266,8 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE("PenaltyBreakAssignment: 1234", PenaltyBreakAssignment, 1234u);
CHECK_PARSE("PenaltyBreakBeforeFirstCallParameter: 1234",
PenaltyBreakBeforeFirstCallParameter, 1234u);
+ CHECK_PARSE("PenaltyBreakBeforeMemberAccess: 1234",
+ PenaltyBreakBeforeMemberAccess, 1234u);
CHECK_PARSE("PenaltyBreakTemplateDeclaration: 1234",
PenaltyBreakTemplateDeclaration, 1234u);
CHECK_PARSE("PenaltyBreakOpenParenthesis: 1234", PenaltyBreakOpenParenthesis,
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 2654615..57f1222 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -22365,6 +22365,24 @@ TEST_F(FormatTest, BreakPenaltyAfterForLoopLParen) {
Style);
}
+TEST_F(FormatTest, BreakPenaltyBeforeMemberAccess) {
+ auto Style = getLLVMStyle();
+ EXPECT_EQ(Style.PenaltyBreakBeforeMemberAccess, 150u);
+
+ Style.ColumnLimit = 60;
+ Style.PenaltyBreakBeforeMemberAccess = 110;
+ verifyFormat("aaaaaaaa.aaaaaaaa.bbbbbbbb()\n"
+ " .ccccccccccccccccccccc(dddddddd);\n"
+ "aaaaaaaa.aaaaaaaa\n"
+ " .bbbbbbbb(cccccccccccccccccccccccccccccccc);",
+ Style);
+
+ Style.ColumnLimit = 13;
+ verifyFormat("foo->bar\n"
+ " .b(a);",
+ Style);
+}
+
TEST_F(FormatTest, BreakPenaltyScopeResolution) {
FormatStyle Style = getLLVMStyle();
Style.ColumnLimit = 20;