Tests: Add more commandlineparser tests.

Add commandlineparser tests for giving two suppressions. Giving
two suppressions in one parameter is not yet supported so it is
todo-test.
This commit is contained in:
Kimmo Varis 2011-09-13 17:55:00 +03:00
parent 1ff7410f4f
commit 288efd832c
1 changed files with 24 additions and 0 deletions

View File

@ -82,6 +82,8 @@ private:
TEST_CASE(suppressionsNoFile);
TEST_CASE(suppressionSingle);
TEST_CASE(suppressionSingleFile);
TEST_CASE(suppressionTwo);
TEST_CASE(suppressionTwoSeparate);
TEST_CASE(templates);
TEST_CASE(templatesGcc);
TEST_CASE(templatesVs);
@ -638,6 +640,28 @@ private:
ASSERT_EQUALS(true, settings.nomsg.isSuppressed("uninitvar", "file.cpp", 1U));
}
void suppressionTwo()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--suppress=uninitvar,unnecessaryQualification", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
TODO_ASSERT_EQUALS(true, false, parser.ParseFromArgs(3, argv));
TODO_ASSERT_EQUALS(true, false, settings.nomsg.isSuppressed("uninitvar", "file.cpp", 1U));
TODO_ASSERT_EQUALS(true, false, settings.nomsg.isSuppressed("unnecessaryQualification", "file.cpp", 1U));
}
void suppressionTwoSeparate()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--suppress=uninitvar", "--suppress=unnecessaryQualification", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT_EQUALS(true, settings.nomsg.isSuppressed("uninitvar", "file.cpp", 1U));
ASSERT_EQUALS(true, settings.nomsg.isSuppressed("unnecessaryQualification", "file.cpp", 1U));
}
void templates()
{
REDIRECT;