Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/catch2/reporters/catch_reporter_combined_tu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ namespace Catch {

void defaultListListeners( std::ostream& out,
std::vector<ListenerDescription> const& descriptions ) {
out << "Registered listeners:\n";

if(descriptions.empty()) {
return;
}

const auto maxNameLen =
std::max_element( descriptions.begin(),
descriptions.end(),
Expand All @@ -163,7 +169,6 @@ namespace Catch {
} )
->name.size();

out << "Registered listeners:\n";
for ( auto const& desc : descriptions ) {
out << TextFlow::Column( static_cast<std::string>( desc.name ) +
':' )
Expand Down
5 changes: 4 additions & 1 deletion tests/ExtraTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ add_test(
NAME TestSpecs::OverrideFailureWithEmptySpec
COMMAND $<TARGET_FILE:NoTests> --allow-running-no-tests
)

add_test(
NAME List::Listeners::WorksWithoutRegisteredListeners
COMMAND $<TARGET_FILE:NoTests> --list-listeners
)
set( EXTRA_TEST_BINARIES
PrefixedMacros
DisabledMacros
Expand Down