mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-22 04:25:40 +02:00

committed by
Martin Hořeňovský

parent
7cbd0b587a
commit
355b3f9952
@@ -18,6 +18,7 @@
|
||||
#include "catch_random_number_generator.h"
|
||||
#include "catch_startup_exception_registry.h"
|
||||
#include "catch_text.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iomanip>
|
||||
@@ -80,6 +81,20 @@ namespace Catch {
|
||||
context.reporter().skipTest(testCase);
|
||||
}
|
||||
|
||||
if (config->warnAboutNoTests() && totals.testCases.total() == 0) {
|
||||
ReusableStringStream testConfig;
|
||||
|
||||
bool first = true;
|
||||
for (const auto& input : config->getTestsOrTags()) {
|
||||
if (!first) { testConfig << ' '; }
|
||||
first = false;
|
||||
testConfig << input;
|
||||
}
|
||||
|
||||
context.reporter().noMatchingTestCases(testConfig.str());
|
||||
totals.error = -1;
|
||||
}
|
||||
|
||||
context.testGroupEnded(config->name(), totals, 1, 1);
|
||||
return totals;
|
||||
}
|
||||
@@ -259,10 +274,11 @@ namespace Catch {
|
||||
if( Option<std::size_t> listed = list( config() ) )
|
||||
return static_cast<int>( *listed );
|
||||
|
||||
auto totals = runTests( m_config );
|
||||
// Note that on unices only the lower 8 bits are usually used, clamping
|
||||
// the return value to 255 prevents false negative when some multiple
|
||||
// of 256 tests has failed
|
||||
return (std::min)( MaxExitCode, static_cast<int>( runTests( m_config ).assertions.failed ) );
|
||||
return (std::min)( { MaxExitCode, totals.error, static_cast<int>( totals.assertions.failed ) } );
|
||||
}
|
||||
catch( std::exception& ex ) {
|
||||
Catch::cerr() << ex.what() << std::endl;
|
||||
|
Reference in New Issue
Block a user