From 1118b132b962fa79efc243d21636b9bddea520f8 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Wed, 2 Feb 2011 13:33:57 +0200 Subject: [PATCH] =?UTF-8?q?Add=20couple=20of=20tests=20for=20xml-version?= =?UTF-8?q?=20cmd=C2=A0line=20option.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/testcmdlineparser.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 009be82f0..8ab68a941 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -84,6 +84,8 @@ private: TEST_CASE(xmlver2); TEST_CASE(xmlver2both); TEST_CASE(xmlver2both2); + TEST_CASE(xmlverunknown); + TEST_CASE(xmlverinvalid); TEST_CASE(errorlist1); TEST_CASE(errorlistverbose1) TEST_CASE(errorlistverbose2) @@ -618,6 +620,24 @@ private: ASSERT_EQUALS(2, settings._xml_version); } + void xmlverunknown() + { + REDIRECT; + const char *argv[] = {"cppcheck", "--xml", "--xml-version=3", "file.cpp"}; + Settings settings; + CmdLineParser parser(&settings); + ASSERT(!parser.ParseFromArgs(4, argv)); + } + + void xmlverinvalid() + { + REDIRECT; + const char *argv[] = {"cppcheck", "--xml", "--xml-version=a", "file.cpp"}; + Settings settings; + CmdLineParser parser(&settings); + ASSERT(!parser.ParseFromArgs(4, argv)); + } + void errorlist1() { REDIRECT;