Skip to content

Commit 4561fb8

Browse files
committed
C++: Add some test cases from cpp/empty-if to the test for cpp/empty-block (exploring overlap).
1 parent 344f808 commit 4561fb8

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
| empty_block.cpp:9:10:9:11 | { ... } | Empty block without comment. |
22
| empty_block.cpp:12:10:13:3 | { ... } | Empty block without comment. |
33
| empty_block.cpp:20:10:21:3 | { ... } | Empty block without comment. |
4+
| empty_block.cpp:84:14:85:3 | { ... } | Empty block without comment. |
5+
| empty_block.cpp:93:10:94:3 | { ... } | Empty block without comment. |
6+
| empty_block.cpp:99:10:100:3 | { ... } | Empty block without comment. |
7+
| empty_block.cpp:100:10:101:3 | { ... } | Empty block without comment. |

‎cpp/ql/test/query-tests/Best Practices/Likely Errors/EmptyBlock/empty_block.cpp‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,25 @@ int f(int x) {
8080
}
8181
}
8282

83+
// BAD
84+
if (x > 1) {
85+
}
86+
87+
// GOOD
88+
if (x) {
89+
++x;
90+
}
91+
92+
// DUBIOUS (reported)
93+
if (x) {
94+
} else {
95+
++x;
96+
}
97+
98+
// BAD (x2)
99+
if (x) {
100+
} else {
101+
}
102+
83103
return 1;
84104
}

0 commit comments

Comments
 (0)