forked from Alepha/Alepha
Describe tests which are skipped.
This helps prevent silent test skipping on normal runs.
This commit is contained in:
@ -26,16 +26,16 @@ namespace Alepha::Hydrogen::Testing::detail::testing
|
||||
std::cerr << "Going to run all tests. (I see " << registry().size() << " tests.)" << std::endl;
|
||||
}
|
||||
bool failed= false;
|
||||
const auto selected= [ selections ]( const std::string test )
|
||||
const auto selected= [selections]( const std::string test )
|
||||
{
|
||||
for( const auto &selection: selections )
|
||||
{
|
||||
if( test.find( selection ) != std::string::npos ) return true;
|
||||
}
|
||||
return empty( selections );
|
||||
return selections.empty();
|
||||
};
|
||||
|
||||
const auto explicitlyNamed= [ selections ]( const std::string s )
|
||||
const auto explicitlyNamed= [selections]( const std::string s )
|
||||
{
|
||||
return std::find( begin( selections ), end( selections ), s ) != end( selections );
|
||||
};
|
||||
@ -44,9 +44,9 @@ namespace Alepha::Hydrogen::Testing::detail::testing
|
||||
{
|
||||
if( C::debugTestRun ) std::cerr << "Trying test " << name << std::endl;
|
||||
|
||||
std::cout << C::testStat << "BEGIN" << resetStyle << " : " << name << std::endl;
|
||||
if( explicitlyNamed( name ) or not disabled and selected( name ) )
|
||||
{
|
||||
std::cout << C::testStat << "BEGIN" << resetStyle << " : " << name << std::endl;
|
||||
try
|
||||
{
|
||||
test();
|
||||
@ -66,8 +66,13 @@ namespace Alepha::Hydrogen::Testing::detail::testing
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
std::cout << C::testStat << "FINISHED" << resetStyle << ": " << name << std::endl;
|
||||
}
|
||||
else if( disabled )
|
||||
{
|
||||
std::cout << " " << C::testPass << "SUCCESS" << resetStyle << ": " << name << std::endl;
|
||||
std::cout << " " << C::testInfo << "Note" << resetStyle << ": Test skipped." << std::endl;
|
||||
}
|
||||
std::cout << C::testStat << "FINISHED" << resetStyle << ": " << name << std::endl;
|
||||
}
|
||||
|
||||
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user