null pointers: Added a todo testcase

This commit is contained in:
Daniel Marjamäki 2009-07-30 21:57:23 +02:00
parent 347802f819
commit 228e926654
1 changed files with 13 additions and 0 deletions

View File

@ -436,6 +436,19 @@ private:
" tok = tok->next();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference\n", errout.str());
checkNullPointer("void foo()\n"
"{\n"
" for (const Token *tok = tokens; tok; tok = tok->next())\n"
" {\n"
" while (tok && tok->str() != \";\")\n"
" tok = tok->next();\n"
" }\n"
"}\n");
// Actual result:
ASSERT_EQUALS("", errout.str());
// Expected (todo) result:
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference\n", errout.str());
}
void nullpointer2()