Write single characters directly instead of as C-strings in Sonarqube

This commit is contained in:
Martin Hořeňovský 2021-05-30 15:54:35 +02:00
parent 02839ba934
commit a01073d871
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -113,26 +113,26 @@ namespace Catch {
XmlWriter::ScopedElement e = xml.scopedElement(elementName); XmlWriter::ScopedElement e = xml.scopedElement(elementName);
ReusableStringStream messageRss; ReusableStringStream messageRss;
messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")"; messageRss << result.getTestMacroName() << '(' << result.getExpression() << ')';
xml.writeAttribute("message"_sr, messageRss.str()); xml.writeAttribute("message"_sr, messageRss.str());
ReusableStringStream textRss; ReusableStringStream textRss;
if (stats.totals.assertions.total() > 0) { if (stats.totals.assertions.total() > 0) {
textRss << "FAILED:\n"; textRss << "FAILED:\n";
if (result.hasExpression()) { if (result.hasExpression()) {
textRss << "\t" << result.getExpressionInMacro() << "\n"; textRss << '\t' << result.getExpressionInMacro() << '\n';
} }
if (result.hasExpandedExpression()) { if (result.hasExpandedExpression()) {
textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n"; textRss << "with expansion:\n\t" << result.getExpandedExpression() << '\n';
} }
} }
if (!result.getMessage().empty()) if (!result.getMessage().empty())
textRss << result.getMessage() << "\n"; textRss << result.getMessage() << '\n';
for (auto const& msg : stats.infoMessages) for (auto const& msg : stats.infoMessages)
if (msg.type == ResultWas::Info) if (msg.type == ResultWas::Info)
textRss << msg.message << "\n"; textRss << msg.message << '\n';
textRss << "at " << result.getSourceInfo(); textRss << "at " << result.getSourceInfo();
xml.writeText(textRss.str(), XmlFormatting::Newline); xml.writeText(textRss.str(), XmlFormatting::Newline);