@@ -27976,6 +27976,11 @@ TEST_F(FormatTest, BreakBinaryOperations) {
27976
27976
" operand1 + operand2 - (operand3 + operand4);",
27977
27977
Style);
27978
27978
27979
+ // Check operator>> special case.
27980
+ verifyFormat("std::cin >> longOperand_1 >> longOperand_2 >>\n"
27981
+ " longOperand_3_;",
27982
+ Style);
27983
+
27979
27984
Style.BreakBinaryOperations = FormatStyle::BBO_OnePerLine;
27980
27985
27981
27986
// Logical operations
@@ -28054,6 +28059,13 @@ TEST_F(FormatTest, BreakBinaryOperations) {
28054
28059
" operand6->member;",
28055
28060
Style);
28056
28061
28062
+ // Check operator>> special case.
28063
+ verifyFormat("std::cin >>\n"
28064
+ " longOperand_1 >>\n"
28065
+ " longOperand_2 >>\n"
28066
+ " longOperand_3_;",
28067
+ Style);
28068
+
28057
28069
Style.BreakBinaryOperations = FormatStyle::BBO_RespectPrecedence;
28058
28070
verifyFormat("result = op1 + op2 * op3 - op4;", Style);
28059
28071
@@ -28079,6 +28091,13 @@ TEST_F(FormatTest, BreakBinaryOperations) {
28079
28091
" byte_buffer[3] << 24;",
28080
28092
Style);
28081
28093
28094
+ // Check operator>> special case.
28095
+ verifyFormat("std::cin >>\n"
28096
+ " longOperand_1 >>\n"
28097
+ " longOperand_2 >>\n"
28098
+ " longOperand_3_;",
28099
+ Style);
28100
+
28082
28101
Style.BreakBinaryOperations = FormatStyle::BBO_OnePerLine;
28083
28102
Style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment;
28084
28103
@@ -28153,6 +28172,13 @@ TEST_F(FormatTest, BreakBinaryOperations) {
28153
28172
" << 24;",
28154
28173
Style);
28155
28174
28175
+ // Check operator>> special case.
28176
+ verifyFormat("std::cin\n"
28177
+ " >> longOperand_1\n"
28178
+ " >> longOperand_2\n"
28179
+ " >> longOperand_3_;",
28180
+ Style);
28181
+
28156
28182
Style.BreakBinaryOperations = FormatStyle::BBO_RespectPrecedence;
28157
28183
verifyFormat("result = op1 + op2 * op3 - op4;", Style);
28158
28184
@@ -28177,6 +28203,13 @@ TEST_F(FormatTest, BreakBinaryOperations) {
28177
28203
" | byte_buffer[2] << 16\n"
28178
28204
" | byte_buffer[3] << 24;",
28179
28205
Style);
28206
+
28207
+ // Check operator>> special case.
28208
+ verifyFormat("std::cin\n"
28209
+ " >> longOperand_1\n"
28210
+ " >> longOperand_2\n"
28211
+ " >> longOperand_3_;",
28212
+ Style);
28180
28213
}
28181
28214
28182
28215
TEST_F(FormatTest, RemoveEmptyLinesInUnwrappedLines) {
0 commit comments