[clang] [clang-format] Fix greatergreater (PR #122282)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 01:41:53 PST 2025


================
@@ -28188,6 +28188,17 @@ TEST_F(FormatTest, BreakBinaryOperations) {
                "                  | byte_buffer[2] << 16\n"
                "                  | byte_buffer[3] << 24;",
                Style);
----------------
andergnet wrote:

I'm not sure I get what you are trying to tell me. Do you want the unit test to be the minimal reproducer of the error?

As far as I have tested the changes work, these are some unit tests I have done (but not commited) to check it:
```
{
  auto Style = getLLVMStyleWithColumns(60);
  Style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment;

  Style.BreakBinaryOperations = FormatStyle::BBO_OnePerLine;

  verifyFormat("std::cin\n"
               "    >> longOperand_1\n"
               "    >> longOperand_2\n"
               "    >> longOperand_3_;",
               Style);

  verifyFormat("std::cin >> longOperand_1 >> longOperand_2 >> longOperand_3;",
               Style);

  Style.BreakBinaryOperations = FormatStyle::BBO_RespectPrecedence;
  verifyFormat("std::cin\n"
               "    >> longOperand_1\n"
               "    >> longOperand_2\n"
               "    >> longOperand_3_;",
               Style);

  verifyFormat("std::cin >> longOperand_1 >> longOperand_2 >> longOperand_3;",
               Style);
}
```

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


More information about the cfe-commits mailing list