Skip to content

Commit 6500bb4

Browse files
committed
test(readability-constant-operand-order): add full CHECK-LEFT expectations
1 parent d899e1e commit 6500bb4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,27 @@ void ok_eq(int a) {
1111
void swap_eq(int a) {
1212
if (0 == a) {} // CHECK-MESSAGES: warning: constant operand should be on the Right side
1313
// CHECK-FIXES: if (a == 0) {} //
14+
// CHECK-LEFT-MESSAGES-NOT: readability-constant-operand-order
1415
}
1516

1617
void swap_asym(int a) {
1718
if (0 < a) {} // CHECK-MESSAGES: warning:
1819
// CHECK-FIXES: if (a > 0) {} //
20+
// CHECK-LEFT-MESSAGES-NOT: readability-constant-operand-order
1921
}
2022

2123
void null_ptr(int *p) {
2224
if (nullptr == p) {} // CHECK-MESSAGES: warning:
2325
// CHECK-FIXES: if (p == nullptr) {} //
26+
// CHECK-LEFT-MESSAGES-NOT: readability-constant-operand-order
2427
}
2528

2629
// No-fix when side effects:
2730
int g();
2831
void side_effects(int a) {
2932
if (0 == g()) {} // CHECK-MESSAGES: warning:
3033
// CHECK-FIXES-NOT: if (g() == 0)
34+
// CHECK-LEFT-MESSAGES-NOT: readability-constant-operand-order
3135
}
3236

3337
// Config variant: allow Left and only ==,!=

0 commit comments

Comments
 (0)