added testcases for testing dangerous functions: mktemp

This commit is contained in:
Martin Ettl 2010-06-20 13:32:00 +02:00
parent c76a9525c1
commit 866d66ba78
1 changed files with 12 additions and 0 deletions

View File

@ -76,6 +76,18 @@ private:
" char *x = mktemp(\"/tmp/zxcv\");\n" " char *x = mktemp(\"/tmp/zxcv\");\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Found 'mktemp'. You should use 'mkstemp' instead\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (style) Found 'mktemp'. You should use 'mkstemp' instead\n", errout.str());
check("char * f(const std::string& strVal)\n"
"{\n"
" return(mktemp(strVal.c_str()));\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Found 'mktemp'. You should use 'mkstemp' instead\n", errout.str());
check("char * f(const std::string& strVal)\n"
"{\n"
" return mktemp(strVal.c_str()) ;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Found 'mktemp'. You should use 'mkstemp' instead\n", errout.str());
} }
void testgets() void testgets()