| 461 | } |
| 462 | |
| 463 | void ToXmlV2Encoding() const { |
| 464 | { |
| 465 | ErrorMessage msg({}, "", Severity::error, "Programming error.\nComparing \"\203\" with \"\003\"", "errorId", Certainty::normal); |
| 466 | const std::string expected(" <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Comparing "\\203" with "\\003"\"/>"); |
| 467 | ASSERT_EQUALS(expected, msg.toXML()); |
| 468 | } |
| 469 | { |
| 470 | const char code1[]="äöü"; |
| 471 | const char code2[]="\x12\x00\x00\x01"; |
| 472 | ErrorMessage msg1({}, "", Severity::error, std::string("Programming error.\nReading \"")+code1+"\"", "errorId", Certainty::normal); |
| 473 | ASSERT_EQUALS(" <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Reading "\\303\\244\\303\\266\\303\\274"\"/>", msg1.toXML()); |
| 474 | ErrorMessage msg2({}, "", Severity::error, std::string("Programming error.\nReading \"")+code2+"\"", "errorId", Certainty::normal); |
| 475 | ASSERT_EQUALS(" <error id=\"errorId\" severity=\"error\" msg=\"Programming error.\" verbose=\"Reading "\\022"\"/>", msg2.toXML()); |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | void FromXmlV2() const { |
| 480 | const char xmldata[] = "<?xml version=\"1.0\"?>\n" |