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

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-05-10 20:52:53 +0200
committerMartin Hořeňovský2022-05-10 20:58:02 +0200
commited6b38b096eac9a976e1fdeee5320fa913146af7 (patch)
tree73b19b8d6b01890e2530e570475ffae38f782264 /src
parent5a49285e9cf203dd20b00ac7488a6a3233d60fff (diff)
downloadcatch3-ed6b38b096eac9a976e1fdeee5320fa913146af7.tar.gz
Specialize XML reporter's listener listing
Diffstat (limited to 'src')
-rw-r--r--src/catch2/reporters/catch_reporter_xml.cpp13
-rw-r--r--src/catch2/reporters/catch_reporter_xml.hpp1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/catch2/reporters/catch_reporter_xml.cpp b/src/catch2/reporters/catch_reporter_xml.cpp
index b8b93235..1e5def41 100644
--- a/src/catch2/reporters/catch_reporter_xml.cpp
+++ b/src/catch2/reporters/catch_reporter_xml.cpp
@@ -259,6 +259,19 @@ namespace Catch {
}
}
+ void XmlReporter::listListeners(std::vector<ListenerDescription> const& descriptions) {
+ auto outerTag = m_xml.scopedElement( "RegisteredListeners" );
+ for ( auto const& listener : descriptions ) {
+ auto inner = m_xml.scopedElement( "Listener" );
+ m_xml.startElement( "Name", XmlFormatting::Indent )
+ .writeText( listener.name, XmlFormatting::None )
+ .endElement( XmlFormatting::Newline );
+ m_xml.startElement( "Description", XmlFormatting::Indent )
+ .writeText( listener.description, XmlFormatting::None )
+ .endElement( XmlFormatting::Newline );
+ }
+ }
+
void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests) {
auto outerTag = m_xml.scopedElement("MatchingTests");
for (auto const& test : tests) {
diff --git a/src/catch2/reporters/catch_reporter_xml.hpp b/src/catch2/reporters/catch_reporter_xml.hpp
index b557bfba..573f9321 100644
--- a/src/catch2/reporters/catch_reporter_xml.hpp
+++ b/src/catch2/reporters/catch_reporter_xml.hpp
@@ -51,6 +51,7 @@ namespace Catch {
void benchmarkFailed( StringRef error ) override;
void listReporters(std::vector<ReporterDescription> const& descriptions) override;
+ void listListeners(std::vector<ListenerDescription> const& descriptions) override;
void listTests(std::vector<TestCaseHandle> const& tests) override;
void listTags(std::vector<TagInfo> const& tags) override;