* Add test for #10603 * Add test for #10559 * Add test for #10212 * Format * Add test for #9744 * Format * Add test for #11140
This commit is contained in:
parent
e09f5f0db7
commit
2fee7a6e3f
|
@ -3585,6 +3585,19 @@ private:
|
|||
" f(\"bbb\", 3);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(int i, const char* a) {\n" // #11140
|
||||
" (void)a[i];\n"
|
||||
"}\n"
|
||||
"void g() {\n"
|
||||
" for (int i = 0; \"01234\"[i]; ++i)\n"
|
||||
" f(i, \"56789\");\n"
|
||||
"}\n"
|
||||
"void h() {\n"
|
||||
" for (int i = 0; \"012\"[i]; ++i)\n"
|
||||
" f(i, \"345\");\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5964,6 +5964,15 @@ private:
|
|||
" }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:5]: (style) The comparison 'Diag == 0' is always true.\n", errout.str());
|
||||
|
||||
// #9744
|
||||
check("void f(const std::vector<int>& ints) {\n"
|
||||
" int i = 0;\n"
|
||||
" for (int p = 0; i < ints.size(); ++i) {\n"
|
||||
" if (p == 0) {}\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:4]: (style) The comparison 'p == 0' is always true.\n", errout.str());
|
||||
}
|
||||
|
||||
void duplicateExpression8() {
|
||||
|
|
Loading…
Reference in New Issue