Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-01-29 20:45:04 +0100
committerMartin Hořeňovský2023-01-29 20:45:13 +0100
commit60264b8807189898a765964fe6325930c230a773 (patch)
treefd56ca3b4d210b05ea96d572a88936658b6b2793 /src
parent65ffee518944372b35a885aa521ac28406f8b8fb (diff)
downloadcatch3-60264b8807189898a765964fe6325930c230a773.tar.gz
Avoid copying strings in sonarqube when sorting tests by file
Diffstat (limited to 'src')
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.cpp4
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.hpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.cpp b/src/catch2/reporters/catch_reporter_sonarqube.cpp
index ac59c87f..dd002b61 100644
--- a/src/catch2/reporters/catch_reporter_sonarqube.cpp
+++ b/src/catch2/reporters/catch_reporter_sonarqube.cpp
@@ -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);
diff --git a/src/catch2/reporters/catch_reporter_sonarqube.hpp b/src/catch2/reporters/catch_reporter_sonarqube.hpp
index bc8f0332..cad6deec 100644
--- a/src/catch2/reporters/catch_reporter_sonarqube.hpp
+++ b/src/catch2/reporters/catch_reporter_sonarqube.hpp
@@ -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);