@@ -19066,6 +19066,11 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
19066
19066
verifyFormat("int a(int x);\n"
19067
19067
"double b();",
19068
19068
Alignment);
19069
+ verifyFormat("int a(const Test & = Test());\n"
19070
+ "int a1(int &foo, const Test & = Test());\n"
19071
+ "int a2(int &foo, const Test &name = Test());\n"
19072
+ "double b();",
19073
+ Alignment);
19069
19074
verifyFormat("struct Test {\n"
19070
19075
" Test(const Test &) = default;\n"
19071
19076
" ~Test() = default;\n"
@@ -19102,6 +19107,13 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
19102
19107
" int x,\n"
19103
19108
" bool y);",
19104
19109
Alignment);
19110
+ // Set ColumnLimit low so that we break the argument list in multiple lines.
19111
+ Alignment.ColumnLimit = 35;
19112
+ verifyFormat("int a3(SomeTypeName1 &x,\n"
19113
+ " SomeTypeName2 &y,\n"
19114
+ " const Test & = Test());\n"
19115
+ "double b();",
19116
+ Alignment);
19105
19117
Alignment.ColumnLimit = OldColumnLimit;
19106
19118
// Ensure function pointers don't screw up recursive alignment
19107
19119
verifyFormat("int a(int x, void (*fp)(int y));\n"
@@ -19287,6 +19299,10 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
19287
19299
"int foobar;",
19288
19300
AlignmentLeft);
19289
19301
19302
+ verifyFormat("int a(SomeType& foo, const Test& = Test());\n"
19303
+ "double b();",
19304
+ AlignmentLeft);
19305
+
19290
19306
// PAS_Middle
19291
19307
FormatStyle AlignmentMiddle = Alignment;
19292
19308
AlignmentMiddle.PointerAlignment = FormatStyle::PAS_Middle;
@@ -19347,6 +19363,10 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
19347
19363
"int foobar;",
19348
19364
AlignmentMiddle);
19349
19365
19366
+ verifyFormat("int a(SomeType & foo, const Test & = Test());\n"
19367
+ "double b();",
19368
+ AlignmentMiddle);
19369
+
19350
19370
Alignment.AlignConsecutiveAssignments.Enabled = false;
19351
19371
Alignment.AlignEscapedNewlines = FormatStyle::ENAS_DontAlign;
19352
19372
verifyFormat("#define A \\\n"
0 commit comments