8205 regression test (#1618)

* Fix trac ticket reference

* Add regression test for #8205

Ticket #8205 was fixed in f65cf220ba.
Add a test case to avoid regressions.
This commit is contained in:
rikardfalkeborn 2019-01-24 07:20:26 +01:00 committed by Daniel Marjamäki
parent 575f62f39c
commit 080c9d53af
1 changed files with 12 additions and 1 deletions

View File

@ -4090,11 +4090,22 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) Same expression on both sides of '&&' because '!b' and 'b1' represent the same value.\n", errout.str());
// 7482
// 7284
check("void f(void) {\n"
" if (a || !!a) {}\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) Same expression on both sides of '||' because 'a' and '!!a' represent the same value.\n", errout.str());
// 8205
check("void f(int x) {\n"
" int Diag = 0;\n"
" switch (x) {\n"
" case 12:\n"
" if (Diag==0) {}\n"
" break;\n"
" }\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:5]: (style) The expression 'Diag == 0' is always true.\n", errout.str());
}
void duplicateExpression8() {