Newlines in the message of a junit_report::TestCase::failure() are stored in the XML as straight newlines. When parsing the XML (for example with python-junit-xml) they are automatically stripped. Instead the newline should be encoded as .
As a workaround I tried &error.to_string().replace("\n", " "), but the is then encoded as