forked from Alepha/Alepha
Describe tests which are skipped.
This helps prevent silent test skipping on normal runs.
This commit is contained in:
@ -27,4 +27,9 @@ namespace
|
||||
{ "smoke", { 1 }, 1 },
|
||||
//{ "fail", { 2 }, 1 },
|
||||
};
|
||||
|
||||
auto skippedTest= -"This Test should be skipped."_test <=[]
|
||||
{
|
||||
throw 0;
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -72,9 +72,9 @@ namespace Alepha::Hydrogen::Testing
|
||||
}
|
||||
}
|
||||
|
||||
// It is okay to discard this, if making tests in an enroll block.
|
||||
inline namespace impl
|
||||
{
|
||||
// It is okay to discard this result, if making tests in an enroll block.
|
||||
struct TestRegistration {};
|
||||
TestRegistration operator <= ( TestName name, std::function< void () > test );
|
||||
}
|
||||
|
Reference in New Issue
Block a user