MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / ToXmlLocations

Method ToXmlLocations

test/testerrorlogger.cpp:441–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439 }
440
441 void ToXmlLocations() const {
442 const ErrorMessage::FileLocation dir1loc{"dir1/a.cpp", 1, 1};
443 const ErrorMessage::FileLocation dir2loc{"dir2\\a.cpp", 1, 1};
444 ErrorMessage::FileLocation dir3loc{"dir/a.cpp", 1, 1};
445 dir3loc.setfile("dir3/a.cpp");
446 ErrorMessage::FileLocation dir4loc{"dir/a.cpp", 1, 1};
447 dir4loc.setfile("dir4\\a.cpp");
448 std::list<ErrorMessage::FileLocation> locs = { dir4loc, dir3loc, dir2loc, dir1loc, fooCpp5, barCpp8_i };
449
450 ErrorMessage msg(std::move(locs), "", Severity::error, "Programming error.\nVerbose error", "errorId", Certainty::normal);
451 std::string message;
452 message += " <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Verbose error\">\n";
453 message += " <location file=\"bar.cpp\" line=\"8\" column=\"1\" info=\"\\303\\244\"/>\n";
454 message += " <location file=\"foo.cpp\" line=\"5\" column=\"1\"/>\n";
455 message += " <location file=\"dir1/a.cpp\" line=\"1\" column=\"1\"/>\n";
456 message += " <location origfile=\"dir2\\a.cpp\" file=\"dir2/a.cpp\" line=\"1\" column=\"1\"/>\n";
457 message += " <location origfile=\"dir/a.cpp\" file=\"dir3/a.cpp\" line=\"1\" column=\"1\"/>\n";
458 message += " <location origfile=\"dir/a.cpp\" file=\"dir4/a.cpp\" line=\"1\" column=\"1\"/>\n";
459 message += " </error>";
460 ASSERT_EQUALS(message, msg.toXML());
461 }
462
463 void ToXmlV2Encoding() const {
464 {

Callers

nothing calls this directly

Calls 2

setfileMethod · 0.80
toXMLMethod · 0.80

Tested by

no test coverage detected