Skip to content

Commit 7e2283d

Browse files
Update testcondition.cpp
1 parent f02c49e commit 7e2283d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/testcondition.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,6 +3640,15 @@ class TestCondition : public TestFixture {
36403640
"}");
36413641
ASSERT_EQUALS("[test.cpp:2:16] -> [test.cpp:3:9]: (warning) Identical condition 'handle!=nullptr', second condition is always false [identicalConditionAfterEarlyExit]\n", errout_str());
36423642

3643+
check("int f(const char* p) {\n" // #13717
3644+
" if (p) {}\n"
3645+
" else if (!p) {}\n"
3646+
" else if (p == NULL) {}\n"
3647+
"}");
3648+
ASSERT_EQUALS("[test.cpp:2:9] -> [test.cpp:3:14]: (style) Expression is always true because 'else if' condition is opposite to previous condition at line 2. [multiCondition]\n"
3649+
"[test.cpp:4:16]: (style) Expression is always false because 'else if' condition matches previous condition at line 3. [multiCondition]\n",
3650+
errout_str());
3651+
36433652
check("void f(void* x, void* y) {\n"
36443653
" if (x == nullptr && y == nullptr)\n"
36453654
" return;\n"

0 commit comments

Comments
 (0)