STL: Fixed TODO test case TestStl::erase5

This commit is contained in:
Daniel Marjamäki 2010-10-09 07:15:34 +02:00
parent f2ba1c6171
commit 068317bed1
2 changed files with 17 additions and 3 deletions

View File

@ -331,6 +331,19 @@ private:
return &tok; return &tok;
} }
/**
* Parse condition. @sa ExecutionPath::parseCondition
* @param tok first token in condition.
* @param checks The execution paths. All execution paths in the list are executed in the current scope
* @return true => bail out all checking
**/
bool parseCondition(const Token &tok, std::list<ExecutionPath *> &checks)
{
(void)tok;
(void)checks;
return false;
}
/** @brief going out of scope - all execution paths end */ /** @brief going out of scope - all execution paths end */
void end(const std::list<ExecutionPath *> &checks, const Token * /*tok*/) const void end(const std::list<ExecutionPath *> &checks, const Token * /*tok*/) const
{ {

View File

@ -453,14 +453,15 @@ private:
{ {
check("void f()\n" check("void f()\n"
"{\n" "{\n"
" std::list<int> foo;\n"
" std::list<int>::iterator it;\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n" " for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n" " {\n"
" if (*it == 123)" " if (*it == 123)\n"
" foo.erase(it);\n" " foo.erase(it);\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (error) Dangerous iterator usage. After erase the iterator is invalid so dereferencing it or comparing it with another iterator is invalid.\n", errout.str());
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Dangerous iterator usage. After erase the iterator is invalid so dereferencing it or comparing it with another iterator is invalid.\n", errout.str());
} }
void eraseBreak() void eraseBreak()