Skip to content

Commit

Permalink
Null pointer: Added todo test case to better handle dereference in co…
Browse files Browse the repository at this point in the history
…ndition
  • Loading branch information
Daniel Marjamäki committed Aug 2, 2011
1 parent 08f2756 commit 493cfa5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/testnullpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ class TestNullPointer : public TestFixture
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", errout.str());

check("void foo(char *p)\n"
"{\n"
" if (*p == 0) { }\n"
" if (!p) { }\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", "", errout.str());

// no error
check("void foo()\n"
"{\n"
Expand Down

0 comments on commit 493cfa5

Please sign in to comment.