Add cmd line parser tests for XML ver 2 options.

This commit is contained in:
Kimmo Varis 2011-01-27 14:25:10 +02:00
parent 97f041f292
commit 090436ea95
1 changed files with 37 additions and 0 deletions

View File

@ -77,6 +77,9 @@ private:
TEST_CASE(templatesGcc);
TEST_CASE(templatesVs);
TEST_CASE(xml);
TEST_CASE(xmlver2);
TEST_CASE(xmlver2both);
TEST_CASE(xmlver2both2);
TEST_CASE(errorlist1);
TEST_CASE(errorlistverbose1)
TEST_CASE(errorlistverbose2)
@ -536,6 +539,40 @@ private:
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT(settings._xml);
ASSERT_EQUALS(1, settings._xml_version);
}
void xmlver2()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--xml-version=2", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT(settings._xml);
ASSERT_EQUALS(2, settings._xml_version);
}
void xmlver2both()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--xml", "--xml-version=2", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT(settings._xml);
ASSERT_EQUALS(2, settings._xml_version);
}
void xmlver2both2()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--xml-version=2", "--xml", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT(settings._xml);
ASSERT_EQUALS(2, settings._xml_version);
}
void errorlist1()