-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[clang-format][NFC] Move AlignAfterOpenBracket tests #154978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add AlignBracketsTest.cpp to collect tests from FormatTest.cpp related to alignment and breaking after open brackets.
@llvm/pr-subscribers-clang-format Author: Gedare Bloom (gedare) ChangesAdd AlignBracketsTest.cpp to collect tests from FormatTest.cpp related to alignment and breaking after open brackets. Patch is 58.95 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/154978.diff 3 Files Affected:
diff --git a/clang/unittests/Format/AlignBracketsTest.cpp b/clang/unittests/Format/AlignBracketsTest.cpp
new file mode 100644
index 0000000000000..c4380ae415751
--- /dev/null
+++ b/clang/unittests/Format/AlignBracketsTest.cpp
@@ -0,0 +1,784 @@
+//===- unittest/Format/AlignBracketsTest.cpp ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "FormatTestBase.h"
+
+#define DEBUG_TYPE "align-brackets-test"
+
+namespace clang {
+namespace format {
+namespace test {
+namespace {
+
+class AlignBracketsTest : public FormatTestBase {};
+
+TEST_F(AlignBracketsTest, AlignsAfterOpenBracket) {
+ verifyFormat(
+ "void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaa aaaaaaaa,\n"
+ " aaaaaaaaa aaaaaaa) {}");
+ verifyFormat(
+ "SomeLongVariableName->someVeryLongFunctionName(aaaaaaaaaaa aaaaaaaaa,\n"
+ " aaaaaaaaaaa aaaaaaaaa);");
+ verifyFormat(
+ "SomeLongVariableName->someFunction(foooooooo(aaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaa));");
+ FormatStyle Style = getLLVMStyle();
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign;
+ verifyFormat("void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaa aaaaaaaa, aaaaaaaaa aaaaaaa) {}",
+ Style);
+ verifyFormat("SomeLongVariableName->someVeryLongFunctionName(\n"
+ " aaaaaaaaaaa aaaaaaaaa, aaaaaaaaaaa aaaaaaaaa);",
+ Style);
+ verifyFormat("SomeLongVariableName->someFunction(\n"
+ " foooooooo(aaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa));",
+ Style);
+ verifyFormat(
+ "void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaa aaaaaaaa,\n"
+ " aaaaaaaaa aaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}",
+ Style);
+ verifyFormat(
+ "SomeLongVariableName->someVeryLongFunctionName(aaaaaaaaaaa aaaaaaaaa,\n"
+ " aaaaaaaaaaa aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);",
+ Style);
+ verifyFormat(
+ "SomeLongVariableName->someFunction(foooooooo(aaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa));",
+ Style);
+
+ verifyFormat("bbbbbbbbbbbb(aaaaaaaaaaaaaaaaaaaaaaaa, //\n"
+ " ccccccc(aaaaaaaaaaaaaaaaa, //\n"
+ " b));",
+ Style);
+
+ Style.ColumnLimit = 30;
+ verifyFormat("for (int foo = 0; foo < FOO;\n"
+ " ++foo) {\n"
+ " bar(foo);\n"
+ "}",
+ Style);
+ Style.ColumnLimit = 80;
+
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak;
+ Style.BinPackArguments = false;
+ Style.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ verifyFormat("void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaa aaaaaaaa,\n"
+ " aaaaaaaaa aaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}",
+ Style);
+ verifyFormat("SomeLongVariableName->someVeryLongFunctionName(\n"
+ " aaaaaaaaaaa aaaaaaaaa,\n"
+ " aaaaaaaaaaa aaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);",
+ Style);
+ verifyFormat("SomeLongVariableName->someFunction(foooooooo(\n"
+ " aaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa));",
+ Style);
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)));",
+ Style);
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaa.aaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)));",
+ Style);
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)),\n"
+ " aaaaaaaaaaaaaaaa);",
+ Style);
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)) &&\n"
+ " aaaaaaaaaaaaaaaa);",
+ Style);
+ verifyFormat(
+ "fooooooooooo(new BARRRRRRRRR(\n"
+ " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));",
+ Style);
+ verifyFormat(
+ "fooooooooooo(::new BARRRRRRRRR(\n"
+ " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));",
+ Style);
+ verifyFormat(
+ "fooooooooooo(new FOO::BARRRR(\n"
+ " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));",
+ Style);
+
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
+ Style.BinPackArguments = false;
+ Style.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+ verifyFormat("void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaa aaaaaaaa,\n"
+ " aaaaaaaaa aaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ ") {}",
+ Style);
+ verifyFormat("SomeLongVariableName->someVeryLongFunctionName(\n"
+ " aaaaaaaaaaa aaaaaaaaa,\n"
+ " aaaaaaaaaaa aaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ ");",
+ Style);
+ verifyFormat("SomeLongVariableName->someFunction(foooooooo(\n"
+ " aaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ "));",
+ Style);
+ verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)\n"
+ "));",
+ Style);
+ verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaa.aaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)\n"
+ "));",
+ Style);
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)\n"
+ " ),\n"
+ " aaaaaaaaaaaaaaaa\n"
+ ");",
+ Style);
+ verifyFormat(
+ "aaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaaa(\n"
+ " aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)\n"
+ " ) &&\n"
+ " aaaaaaaaaaaaaaaa\n"
+ ");",
+ Style);
+ verifyFormat("void foo(\n"
+ " void (*foobarpntr)(\n"
+ " aaaaaaaaaaaaaaaaaa *,\n"
+ " bbbbbbbbbbbbbb *,\n"
+ " cccccccccccccccccccc *,\n"
+ " dddddddddddddddddd *\n"
+ " )\n"
+ ");",
+ Style);
+ verifyFormat("aaaaaaa<bbbbbbbb> const aaaaaaaaaa{\n"
+ " aaaaaaaaaaaaa(aaaaaaaaaaa, aaaaaaaaaaaaaaaa)\n"
+ "};",
+ Style);
+
+ verifyFormat("bool aaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " const bool &aaaaaaaaa, const void *aaaaaaaaaa\n"
+ ") const {\n"
+ " return true;\n"
+ "}",
+ Style);
+ verifyFormat("bool aaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " const bool &aaaaaaaaaa, const void *aaaaaaaaaa\n"
+ ") const;",
+ Style);
+ verifyFormat("void aaaaaaaaa(\n"
+ " int aaaaaa, int bbbbbb, int cccccc, int dddddddddd\n"
+ ") const noexcept -> std::vector<of_very_long_type>;",
+ Style);
+ verifyFormat(
+ "x = aaaaaaaaaaaaaaa(\n"
+ " \"a aaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaa\"\n"
+ ");",
+ Style);
+ Style.ColumnLimit = 60;
+ verifyFormat("auto lambda =\n"
+ " [&b](\n"
+ " auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
+ " ) {};",
+ Style);
+ verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " &bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"
+ ");",
+ Style);
+}
+
+TEST_F(AlignBracketsTest, AlignAfterOpenBracketBlockIndent) {
+ auto Style = getLLVMStyle();
+
+ StringRef Short = "functionCall(paramA, paramB, paramC);\n"
+ "void functionDecl(int a, int b, int c);";
+
+ StringRef Medium = "functionCall(paramA, paramB, paramC, paramD, paramE, "
+ "paramF, paramG, paramH, paramI);\n"
+ "void functionDecl(int argumentA, int argumentB, int "
+ "argumentC, int argumentD, int argumentE);";
+
+ verifyFormat(Short, Style);
+
+ StringRef NoBreak = "functionCall(paramA, paramB, paramC, paramD, paramE, "
+ "paramF, paramG, paramH,\n"
+ " paramI);\n"
+ "void functionDecl(int argumentA, int argumentB, int "
+ "argumentC, int argumentD,\n"
+ " int argumentE);";
+
+ verifyFormat(NoBreak, Medium, Style);
+ verifyFormat(NoBreak,
+ "functionCall(\n"
+ " paramA,\n"
+ " paramB,\n"
+ " paramC,\n"
+ " paramD,\n"
+ " paramE,\n"
+ " paramF,\n"
+ " paramG,\n"
+ " paramH,\n"
+ " paramI\n"
+ ");\n"
+ "void functionDecl(\n"
+ " int argumentA,\n"
+ " int argumentB,\n"
+ " int argumentC,\n"
+ " int argumentD,\n"
+ " int argumentE\n"
+ ");",
+ Style);
+
+ verifyFormat("outerFunctionCall(nestedFunctionCall(argument1),\n"
+ " nestedLongFunctionCall(argument1, "
+ "argument2, argument3,\n"
+ " argument4, "
+ "argument5));",
+ Style);
+
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
+
+ verifyFormat(Short, Style);
+ verifyFormat(
+ "functionCall(\n"
+ " paramA, paramB, paramC, paramD, paramE, paramF, paramG, paramH, "
+ "paramI\n"
+ ");\n"
+ "void functionDecl(\n"
+ " int argumentA, int argumentB, int argumentC, int argumentD, int "
+ "argumentE\n"
+ ");",
+ Medium, Style);
+
+ Style.AllowAllArgumentsOnNextLine = false;
+ Style.AllowAllParametersOfDeclarationOnNextLine = false;
+
+ verifyFormat(Short, Style);
+ verifyFormat(
+ "functionCall(\n"
+ " paramA, paramB, paramC, paramD, paramE, paramF, paramG, paramH, "
+ "paramI\n"
+ ");\n"
+ "void functionDecl(\n"
+ " int argumentA, int argumentB, int argumentC, int argumentD, int "
+ "argumentE\n"
+ ");",
+ Medium, Style);
+
+ Style.BinPackArguments = false;
+ Style.BinPackParameters = FormatStyle::BPPS_OnePerLine;
+
+ verifyFormat(Short, Style);
+
+ verifyFormat("functionCall(\n"
+ " paramA,\n"
+ " paramB,\n"
+ " paramC,\n"
+ " paramD,\n"
+ " paramE,\n"
+ " paramF,\n"
+ " paramG,\n"
+ " paramH,\n"
+ " paramI\n"
+ ");\n"
+ "void functionDecl(\n"
+ " int argumentA,\n"
+ " int argumentB,\n"
+ " int argumentC,\n"
+ " int argumentD,\n"
+ " int argumentE\n"
+ ");",
+ Medium, Style);
+
+ verifyFormat("outerFunctionCall(\n"
+ " nestedFunctionCall(argument1),\n"
+ " nestedLongFunctionCall(\n"
+ " argument1,\n"
+ " argument2,\n"
+ " argument3,\n"
+ " argument4,\n"
+ " argument5\n"
+ " )\n"
+ ");",
+ Style);
+
+ verifyFormat("int a = (int)b;", Style);
+ verifyFormat("int a = (int)b;",
+ "int a = (\n"
+ " int\n"
+ ") b;",
+ Style);
+
+ verifyFormat("return (true);", Style);
+ verifyFormat("return (true);",
+ "return (\n"
+ " true\n"
+ ");",
+ Style);
+
+ verifyFormat("void foo();", Style);
+ verifyFormat("void foo();",
+ "void foo(\n"
+ ");",
+ Style);
+
+ verifyFormat("void foo() {}", Style);
+ verifyFormat("void foo() {}",
+ "void foo(\n"
+ ") {\n"
+ "}",
+ Style);
+
+ verifyFormat("auto string = std::string();", Style);
+ verifyFormat("auto string = std::string();",
+ "auto string = std::string(\n"
+ ");",
+ Style);
+
+ verifyFormat("void (*functionPointer)() = nullptr;", Style);
+ verifyFormat("void (*functionPointer)() = nullptr;",
+ "void (\n"
+ " *functionPointer\n"
+ ")\n"
+ "(\n"
+ ") = nullptr;",
+ Style);
+}
+
+TEST_F(AlignBracketsTest, AlignAfterOpenBracketBlockIndentIfStatement) {
+ auto Style = getLLVMStyle();
+
+ verifyFormat("if (foo()) {\n"
+ " return;\n"
+ "}",
+ Style);
+
+ verifyFormat("if (quiteLongArg !=\n"
+ " (alsoLongArg - 1)) { // ABC is a very longgggggggggggg "
+ "comment\n"
+ " return;\n"
+ "}",
+ Style);
+
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
+
+ verifyFormat("if (foo()) {\n"
+ " return;\n"
+ "}",
+ Style);
+
+ verifyFormat("if (quiteLongArg !=\n"
+ " (alsoLongArg - 1)) { // ABC is a very longgggggggggggg "
+ "comment\n"
+ " return;\n"
+ "}",
+ Style);
+
+ verifyFormat("void foo() {\n"
+ " if (camelCaseName < alsoLongName ||\n"
+ " anotherEvenLongerName <=\n"
+ " thisReallyReallyReallyReallyReallyReallyLongerName ||"
+ "\n"
+ " otherName < thisLastName) {\n"
+ " return;\n"
+ " } else if (quiteLongName < alsoLongName ||\n"
+ " anotherEvenLongerName <=\n"
+ " thisReallyReallyReallyReallyReallyReallyLonger"
+ "Name ||\n"
+ " otherName < thisLastName) {\n"
+ " return;\n"
+ " }\n"
+ "}",
+ Style);
+
+ Style.ContinuationIndentWidth = 2;
+ verifyFormat("void foo() {\n"
+ " if (ThisIsRatherALongIfClause && thatIExpectToBeBroken ||\n"
+ " ontoMultipleLines && whenFormattedCorrectly) {\n"
+ " if (false) {\n"
+ " return;\n"
+ " } else if (thisIsRatherALongIfClause && "
+ "thatIExpectToBeBroken ||\n"
+ " ontoMultipleLines && whenFormattedCorrectly) {\n"
+ " return;\n"
+ " }\n"
+ " }\n"
+ "}",
+ Style);
+}
+
+TEST_F(AlignBracketsTest, AlignAfterOpenBracketBlockIndentForStatement) {
+ auto Style = getLLVMStyle();
+
+ verifyFormat("for (int i = 0; i < 5; ++i) {\n"
+ " doSomething();\n"
+ "}",
+ Style);
+
+ verifyFormat("for (int myReallyLongCountVariable = 0; "
+ "myReallyLongCountVariable < count;\n"
+ " myReallyLongCountVariable++) {\n"
+ " doSomething();\n"
+ "}",
+ Style);
+
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
+
+ verifyFormat("for (int i = 0; i < 5; ++i) {\n"
+ " doSomething();\n"
+ "}",
+ Style);
+
+ verifyFormat("for (int myReallyLongCountVariable = 0; "
+ "myReallyLongCountVariable < count;\n"
+ " myReallyLongCountVariable++) {\n"
+ " doSomething();\n"
+ "}",
+ Style);
+}
+
+TEST_F(AlignBracketsTest, AlignAfterOpenBracketBlockIndentInitializers) {
+ auto Style = getLLVMStyleWithColumns(60);
+ Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
+ // Aggregate initialization.
+ verifyFormat("int LooooooooooooooooooooooooongVariable[2] = {\n"
+ " 10000000, 20000000\n"
+ "};",
+ Style);
+ verifyFormat("SomeStruct s{\n"
+ " \"xxxxxxxxxxxxxxxx\", \"yyyyyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzzzzz\"\n"
+ "};",
+ Style);
+ // Designated initializers.
+ verifyFormat("int LooooooooooooooooooooooooongVariable[2] = {\n"
+ " [0] = 10000000, [1] = 20000000\n"
+ "};",
+ Style);
+ verifyFormat("SomeStruct s{\n"
+ " .foo = \"xxxxxxxxxxxxx\",\n"
+ " .bar = \"yyyyyyyyyyyyy\",\n"
+ " .baz = \"zzzzzzzzzzzzz\"\n"
+ "};",
+ Style);
+ // List initialization.
+ verifyFormat("SomeStruct s{\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ verifyFormat("SomeStruct{\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ verifyFormat("new SomeStruct{\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ // Member initializer.
+ verifyFormat("class SomeClass {\n"
+ " SomeStruct s{\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ " };\n"
+ "};",
+ Style);
+ // Constructor member initializer.
+ verifyFormat("SomeClass::SomeClass : strct{\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ " } {}",
+ Style);
+ // Copy initialization.
+ verifyFormat("SomeStruct s = SomeStruct{\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ // Copy list initialization.
+ verifyFormat("SomeStruct s = {\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ // Assignment operand initialization.
+ verifyFormat("s = {\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ // Returned object initialization.
+ verifyFormat("return {\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ // Initializer list.
+ verifyFormat("auto initializerList = {\n"
+ " \"xxxxxxxxxxxxx\",\n"
+ " \"yyyyyyyyyyyyy\",\n"
+ " \"zzzzzzzzzzzzz\",\n"
+ "};",
+ Style);
+ // Function parameter initialization.
+ verifyFormat("func({\n"
+ " \"x...
[truncated]
|
owenca
approved these changes
Aug 23, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add AlignBracketsTest.cpp to collect tests from FormatTest.cpp related to alignment and breaking after open brackets.