[clang] [clang-format] Fix erroneous BraceWrapping.BeforeLambdaBody column calcs (PR #76673)
James Grant via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 1 15:44:09 PST 2024
================
@@ -22965,6 +22965,84 @@ TEST_F(FormatTest, EmptyLinesInLambdas) {
"};");
}
+TEST_F(FormatTest, BreakBeforeLambdaBodyWrapping) {
+ verifyFormat("connect([]() {\n"
+ " foo();\n"
+ " bar();\n"
+ "});");
+
+ auto Style = getLLVMStyle();
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.BeforeLambdaBody = true;
+
+ verifyFormat("connect(\n"
+ " []()\n"
+ " {\n"
+ " foo();\n"
+ " bar();\n"
+ " });",
+ Style);
+
+ for (unsigned l : {0, 41}) {
----------------
jamesg-nz wrote:
Now testing ColumnLimit = 0 once separately. Unrolled remaining loop (that doesn't test = 0) into two verifications.
Loops make it hard to see in test results for what value it is failing for, I guess. Although saw other people had used them in that file.
https://github.com/llvm/llvm-project/pull/76673
More information about the cfe-commits
mailing list