added a testcase for detecting duplicate if else branches.

This commit is contained in:
Ettl Martin 2012-05-29 09:22:42 +02:00
parent 2bd171dded
commit 474dccf8ad
1 changed files with 17 additions and 0 deletions

View File

@ -3918,6 +3918,23 @@ private:
" foo(i);\n"
"}");
ASSERT_EQUALS("", errout.str());
check("void f(const std::string &token)\n"
"{\n"
" if( token == \"C\")\n"
" {\n"
" std::cout << \"C\";\n"
" }\n"
" else if ( token == \"A\" )\n"
" {\n"
" std::cout << \"A\";\n"
" }\n"
" else if ( token == \"A\" )\n"
" {\n"
" std::cout << \"A\";\n"
" }\n"
"}\n");
ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:7]: (style) Found duplicate if expressions.\n", errout.str());
}
void duplicateBranch() {