diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 3c2599c9a..78dc5be51 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -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()