mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16:10 +01:00
Specialize XML reporter's listener listing
This commit is contained in:
parent
5a49285e9c
commit
ed6b38b096
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -219,7 +219,17 @@ add_test(NAME List::Listeners::ExitCode
|
||||
COMMAND
|
||||
$<TARGET_FILE:SelfTest> --list-listeners
|
||||
)
|
||||
|
||||
add_test(NAME List::Listeners::XmlOutput
|
||||
COMMAND
|
||||
$<TARGET_FILE:SelfTest>
|
||||
--list-listeners
|
||||
--reporter xml
|
||||
)
|
||||
set_tests_properties(List::Listeners::XmlOutput
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "<RegisteredListeners>"
|
||||
FAIL_REGULAR_EXPRESSION "Registered listeners:"
|
||||
)
|
||||
|
||||
add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions "An empty test with no assertions")
|
||||
set_tests_properties(NoAssertions PROPERTIES PASS_REGULAR_EXPRESSION "No assertions in test case")
|
||||
|
Loading…
Reference in New Issue
Block a user