[clang] [clang-format] Fix erroneous BraceWrapping.BeforeLambdaBody column calcs (PR #76673)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 1 08:04:04 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}) {
----------------
HazardyKnusperkeks wrote:

Don't loop. Pick some values.

https://github.com/llvm/llvm-project/pull/76673


More information about the cfe-commits mailing list