Merge branch 'master' of github.com:danmar/cppcheck

This commit is contained in:
firewave 2010-04-14 12:04:02 +02:00
commit 2a0ac7dd7c
1 changed files with 25 additions and 0 deletions

View File

@ -60,6 +60,7 @@ private:
TEST_CASE(getErrorMessages);
TEST_CASE(parseOutputtingArgs);
TEST_CASE(parseOutputtingInvalidArgs);
TEST_CASE(parseArgsAndCheck);
}
bool argCheck(int argc, const char *argv[])
@ -70,6 +71,30 @@ private:
return cppCheck.parseFromArgs(argc, argv);
}
bool argCheckWithCheck(int argc, const char *argv[], const std::string &data)
{
errout.str("");
output.str("");
CppCheck cppCheck(*this);
cppCheck.addFile("file.cpp", data);
bool result = cppCheck.parseFromArgs(argc, argv);
if (result)
cppCheck.check();
return result;
}
void parseArgsAndCheck()
{
{
const char *argv[] = {"cppcheck", "--showtime=top5"};
const char *data = "void foo(){}";
ASSERT_EQUALS(true, argCheckWithCheck(2, argv, data));
ASSERT_EQUALS("", errout.str());
// ASSERT_EQUALS(true, output.str().find("Overall time:") != std::string::npos);
}
}
void parseOutputtingArgs()
{
{