Added a regression test for ticket #8892 - FN: knownConditionTrueFalse
This commit is contained in:
parent
7405ea039d
commit
c30333425b
|
@ -1642,6 +1642,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void secondAlwaysTrueFalseWhenFirstTrueError() {
|
void secondAlwaysTrueFalseWhenFirstTrueError() {
|
||||||
|
check("void f(void) {\n" // #8892
|
||||||
|
" const char c[1] = { \'x\' }; \n"
|
||||||
|
" if(c[0] == \'x\'){;}\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'c[0]=='x'' is always true\n", errout.str());
|
||||||
|
|
||||||
check("void f(int x) {\n"
|
check("void f(int x) {\n"
|
||||||
" if (x > 5 && x != 1)\n"
|
" if (x > 5 && x != 1)\n"
|
||||||
" a++;\n"
|
" a++;\n"
|
||||||
|
|
Loading…
Reference in New Issue