Fixed #2544 (XML output does not specify encoding used)
This commit is contained in:
parent
7d73b523be
commit
447d29938e
|
@ -150,7 +150,7 @@ std::string ErrorLogger::ErrorMessage::getXMLHeader(int xml_version)
|
|||
|
||||
// standard xml header
|
||||
std::ostringstream ostr;
|
||||
ostr << "<?xml version=\"1.0\"?>\n";
|
||||
ostr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
|
||||
// version 1 header
|
||||
if (xml_version <= 1)
|
||||
|
|
|
@ -125,7 +125,7 @@ private:
|
|||
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
||||
locs.push_back(loc);
|
||||
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId");
|
||||
ASSERT_EQUALS("<?xml version=\"1.0\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
||||
ASSERT_EQUALS("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
||||
ASSERT_EQUALS("</results>", ErrorLogger::ErrorMessage::getXMLFooter(1));
|
||||
ASSERT_EQUALS("<error file=\"foo.cpp\" line=\"5\" id=\"errorId\" severity=\"error\" msg=\"Programming error.\"/>", msg.toXML(false,1));
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ private:
|
|||
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
||||
locs.push_back(loc);
|
||||
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId");
|
||||
ASSERT_EQUALS("<?xml version=\"1.0\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
||||
ASSERT_EQUALS("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results>", ErrorLogger::ErrorMessage::getXMLHeader(1));
|
||||
ASSERT_EQUALS("</results>", ErrorLogger::ErrorMessage::getXMLFooter(1));
|
||||
ASSERT_EQUALS("<error file=\"foo.cpp\" line=\"5\" id=\"errorId\" severity=\"error\" msg=\"Verbose error\"/>", msg.toXML(true,1));
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
std::list<ErrorLogger::ErrorMessage::FileLocation> locs;
|
||||
locs.push_back(loc);
|
||||
ErrorMessage msg(locs, Severity::error, "Programming error.\nVerbose error", "errorId");
|
||||
std::string header("<?xml version=\"1.0\"?>\n<results version=\"2\">\n");
|
||||
std::string header("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<results version=\"2\">\n");
|
||||
header += " <cppcheck version=\"";
|
||||
header += CppCheck::version();
|
||||
header += "\"/>\n <errors>";
|
||||
|
|
Loading…
Reference in New Issue