Skip to content

Commit d899e1e

Browse files
committed
test(readability-constant-operand-order): add CHECK-LEFT expectations for ok_eq
1 parent a8534c1 commit d899e1e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clang-tools-extra/test/clang-tidy/checkers/readability/constant-operand-order.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
// RUN: %check_clang_tidy %s readability-constant-operand-order %t -- -- -std=c++17
2+
// RUN: %check_clang_tidy -check-suffixes=LEFT %s readability-constant-operand-order %t -- \
3+
// RUN: --config="{CheckOptions:[{key: readability-constant-operand-order.PreferredConstantSide, value: Left}, {key: readability-constant-operand-order.BinaryOperators, value: '==,!='}]}" -- -std=c++17
4+
15
void ok_eq(int a) {
26
if (a == 0) {} // CHECK-MESSAGES-NOT: readability-constant-operand-order
37
// CHECK-LEFT-MESSAGES: warning: constant operand should be on the Left side
48
// CHECK-LEFT-FIXES: if (0 == a) {} //
59
}
610

7-
811
void swap_eq(int a) {
912
if (0 == a) {} // CHECK-MESSAGES: warning: constant operand should be on the Right side
1013
// CHECK-FIXES: if (a == 0) {} //
@@ -32,4 +35,4 @@ void left_ok(int a) {
3235
if (0 == a) {} // CHECK-MESSAGES: warning:
3336
// CHECK-FIXES: if (a == 0) {} //
3437
// CHECK-LEFT-MESSAGES-NOT: readability-constant-operand-order
35-
}
38+
}

0 commit comments

Comments
 (0)