Skip to content

Commit a6b8339

Browse files
Add test for #10607 (#3576)
* Add test for #10607 * Format
1 parent 6a822f4 commit a6b8339

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/testother.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class TestOther : public TestFixture {
165165
TEST_CASE(checkSuspiciousSemicolon1);
166166
TEST_CASE(checkSuspiciousSemicolon2);
167167
TEST_CASE(checkSuspiciousSemicolon3);
168+
TEST_CASE(checkSuspiciousComparison);
168169

169170
TEST_CASE(checkInvalidFree);
170171

@@ -6698,6 +6699,19 @@ class TestOther : public TestFixture {
66986699
ASSERT_EQUALS("", errout.str());
66996700
}
67006701

6702+
void checkSuspiciousComparison() {
6703+
checkP("void f(int a, int b) {\n"
6704+
" a > b;\n"
6705+
"}");
6706+
ASSERT_EQUALS("[test.cpp:2]: (warning, inconclusive) Found suspicious operator '>'\n", errout.str());
6707+
6708+
checkP("void f() {\n" // #10607
6709+
" for (auto p : m)\n"
6710+
" std::vector<std::pair<std::string, std::string>> k;\n"
6711+
"}");
6712+
ASSERT_EQUALS("", errout.str());
6713+
}
6714+
67016715
void checkInvalidFree() {
67026716
check("void foo(char *p) {\n"
67036717
" char *a; a = malloc(1024);\n"

0 commit comments

Comments
 (0)