Avoid copying strings in sonarqube when sorting tests by file

This commit is contained in:
Martin Hořeňovský 2023-01-29 20:45:04 +01:00
parent 65ffee5189
commit 60264b8807
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ namespace Catch {
}
void SonarQubeReporter::writeRun( TestRunNode const& runNode ) {
std::map<std::string, std::vector<TestCaseNode const*>> testsPerFile;
std::map<StringRef, std::vector<TestCaseNode const*>> testsPerFile;
for ( auto const& child : runNode.children ) {
testsPerFile[child->value.testInfo->lineInfo.file].push_back(
@ -52,7 +52,7 @@ namespace Catch {
}
}
void SonarQubeReporter::writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes) {
void SonarQubeReporter::writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes) {
XmlWriter::ScopedElement e = xml.scopedElement("file");
xml.writeAttribute("path"_sr, filename);

View File

@ -41,7 +41,7 @@ namespace Catch {
void writeRun( TestRunNode const& groupNode );
void writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes);
void writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes);
void writeTestCase(TestCaseNode const& testCaseNode);