mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Fix crash when running with --list-listeners and no registered listeners (#2442)
Co-authored-by: Sergio Losilla <sergio.losilla@nt-bnct.com>
This commit is contained in:
parent
40dd9dd3f4
commit
5efd327dd4
@ -154,6 +154,12 @@ namespace Catch {
|
|||||||
|
|
||||||
void defaultListListeners( std::ostream& out,
|
void defaultListListeners( std::ostream& out,
|
||||||
std::vector<ListenerDescription> const& descriptions ) {
|
std::vector<ListenerDescription> const& descriptions ) {
|
||||||
|
out << "Registered listeners:\n";
|
||||||
|
|
||||||
|
if(descriptions.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto maxNameLen =
|
const auto maxNameLen =
|
||||||
std::max_element( descriptions.begin(),
|
std::max_element( descriptions.begin(),
|
||||||
descriptions.end(),
|
descriptions.end(),
|
||||||
@ -163,7 +169,6 @@ namespace Catch {
|
|||||||
} )
|
} )
|
||||||
->name.size();
|
->name.size();
|
||||||
|
|
||||||
out << "Registered listeners:\n";
|
|
||||||
for ( auto const& desc : descriptions ) {
|
for ( auto const& desc : descriptions ) {
|
||||||
out << TextFlow::Column( static_cast<std::string>( desc.name ) +
|
out << TextFlow::Column( static_cast<std::string>( desc.name ) +
|
||||||
':' )
|
':' )
|
||||||
|
@ -459,7 +459,10 @@ add_test(
|
|||||||
NAME TestSpecs::OverrideFailureWithEmptySpec
|
NAME TestSpecs::OverrideFailureWithEmptySpec
|
||||||
COMMAND $<TARGET_FILE:NoTests> --allow-running-no-tests
|
COMMAND $<TARGET_FILE:NoTests> --allow-running-no-tests
|
||||||
)
|
)
|
||||||
|
add_test(
|
||||||
|
NAME List::Listeners::WorksWithoutRegisteredListeners
|
||||||
|
COMMAND $<TARGET_FILE:NoTests> --list-listeners
|
||||||
|
)
|
||||||
set( EXTRA_TEST_BINARIES
|
set( EXTRA_TEST_BINARIES
|
||||||
PrefixedMacros
|
PrefixedMacros
|
||||||
DisabledMacros
|
DisabledMacros
|
||||||
|
Loading…
Reference in New Issue
Block a user