Skip to content

Commit f09b413

Browse files
committed
Ticket #8407: Added regression test
1 parent c3af708 commit f09b413

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/testcondition.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4031,6 +4031,15 @@ class TestCondition : public TestFixture {
40314031
"}");
40324032
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'x==-5' is always false\n", errout.str());
40334033

4034+
// #8407
4035+
check("int f(void) {\n"
4036+
" for(int i = 0; i <1; ++i)\n"
4037+
" if(i == 0) return 1; \n" // <<
4038+
" else return 0;\n"
4039+
" return -1;\n"
4040+
"}");
4041+
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'i==0' is always true\n", errout.str());
4042+
40344043
check("void f(unsigned int u1, unsigned int u2) {\n"
40354044
" if (u1 <= 10 && u2 >= 20) {\n"
40364045
" if (u1 != u2) {}\n"

0 commit comments

Comments
 (0)