From 068317bed19956a418168c644057c8cb5b07f3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 9 Oct 2010 07:15:34 +0200 Subject: [PATCH] STL: Fixed TODO test case TestStl::erase5 --- lib/checkstl.cpp | 13 +++++++++++++ test/teststl.cpp | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 74814cca2..142251967 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -331,6 +331,19 @@ private: 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 &checks) + { + (void)tok; + (void)checks; + return false; + } + /** @brief going out of scope - all execution paths end */ void end(const std::list &checks, const Token * /*tok*/) const { diff --git a/test/teststl.cpp b/test/teststl.cpp index 19e1b7527..9234a584d 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -453,14 +453,15 @@ private: { check("void f()\n" "{\n" + " std::list foo;\n" + " std::list::iterator it;\n" " for (it = foo.begin(); it != foo.end(); ++it)\n" " {\n" - " if (*it == 123)" + " if (*it == 123)\n" " foo.erase(it);\n" " }\n" "}\n"); - ASSERT_EQUALS("", 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()); + 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()); } void eraseBreak()