Tests: Add tests for new --enable flags.

Adding tests for new --enable flafgs (performance, portability)
to CommandLineParser tests.
This commit is contained in:
Kimmo Varis 2011-09-04 21:42:35 +03:00
parent bb5e531c7f
commit 0c42f46717
1 changed files with 34 additions and 0 deletions

View File

@ -60,6 +60,8 @@ private:
TEST_CASE(includes2);
TEST_CASE(enabledAll);
TEST_CASE(enabledStyle);
TEST_CASE(enabledPerformance);
TEST_CASE(enabledPortability);
TEST_CASE(enabledUnusedFunction);
TEST_CASE(enabledMissingInclude);
TEST_CASE(errorExitcode);
@ -403,6 +405,38 @@ private:
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT(settings.isEnabled("style"));
ASSERT(settings.isEnabled("performance"));
ASSERT(settings.isEnabled("portability"));
ASSERT(!settings.isEnabled("unusedFunction"));
ASSERT(!settings.isEnabled("missingInclude"));
}
void enabledPerformance()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--enable=performance", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT(!settings.isEnabled("style"));
ASSERT(settings.isEnabled("performance"));
ASSERT(!settings.isEnabled("portability"));
ASSERT(!settings.isEnabled("unusedFunction"));
ASSERT(!settings.isEnabled("missingInclude"));
}
void enabledPortability()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--enable=portability", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT(!settings.isEnabled("style"));
ASSERT(!settings.isEnabled("performance"));
ASSERT(settings.isEnabled("portability"));
ASSERT(!settings.isEnabled("unusedFunction"));
ASSERT(!settings.isEnabled("missingInclude"));
}
void enabledUnusedFunction()