forked from Alepha/Alepha
Put in some structure to test output.
This helps to visually distinguish between different cases which executed and when new tests start.
This commit is contained in:
@ -383,10 +383,10 @@ namespace Alepha::Hydrogen::Testing ::detail:: table_test
|
|||||||
const auto result= checker( invoker );
|
const auto result= checker( invoker );
|
||||||
if( not result )
|
if( not result )
|
||||||
{
|
{
|
||||||
std::cout << " " << C::testFail << "FAILED CASE" << resetStyle << ": " << comment << std::endl;
|
std::cout << " " << C::testFail << "FAILED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
++failureCount;
|
++failureCount;
|
||||||
}
|
}
|
||||||
else std::cout << " " << C::testPass << "PASSED CASE" << resetStyle << ": " << comment << std::endl;
|
else std::cout << " " << C::testPass << "PASSED CASE" << resetStyle << ": " << comment << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return failureCount;
|
return failureCount;
|
||||||
|
|||||||
@ -12,7 +12,8 @@ namespace Alepha::Hydrogen::Testing ::detail:: testing_colors
|
|||||||
{
|
{
|
||||||
inline const auto testFail= createStyle( "test-failure", setFgColor( BasicTextColor::red ) );
|
inline const auto testFail= createStyle( "test-failure", setFgColor( BasicTextColor::red ) );
|
||||||
inline const auto testPass= createStyle( "test-success", setFgColor( BasicTextColor::green ) );
|
inline const auto testPass= createStyle( "test-success", setFgColor( BasicTextColor::green ) );
|
||||||
inline const auto testInfo= createStyle( "test-info", "italic ansi:5"_sgr );
|
inline const auto testWarn= createStyle( "test-warn", "italic ansi:5"_sgr );
|
||||||
|
inline const auto testInfo= createStyle( "test-info", "ext:rgb235"_sgr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,29 +192,33 @@ namespace Alepha::Hydrogen::Testing
|
|||||||
};
|
};
|
||||||
|
|
||||||
for( const auto &[ name, disabled, test ]: registry() )
|
for( const auto &[ name, disabled, test ]: registry() )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if( C::debugTestRun ) std::cerr << "Trying test " << name << std::endl;
|
if( C::debugTestRun ) std::cerr << "Trying test " << name << std::endl;
|
||||||
|
|
||||||
if( explicitlyNamed( name ) or not disabled and selected( name ) )
|
if( explicitlyNamed( name ) or not disabled and selected( name ) )
|
||||||
{
|
{
|
||||||
std::cout << C::testPass << "BEGIN " << resetStyle << ": " << name << std::endl;
|
std::cout << C::testInfo << "BEGIN" << resetStyle << " : " << name << std::endl;
|
||||||
test();
|
try
|
||||||
std::cout << C::testPass << "SUCCESS" << resetStyle << ": " << name << std::endl;
|
{
|
||||||
|
test();
|
||||||
|
std::cout << " " << C::testPass << "SUCCESS" << resetStyle << ": " << name << std::endl;
|
||||||
|
}
|
||||||
|
catch( ... )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
failed= true;
|
||||||
|
std::cout << " " << C::testFail << "FAILURE" << resetStyle << ": " << name;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch( const TestFailureException &fail ) { std::cout << " -- " << fail.failureCount << " failures."; }
|
||||||
|
catch( ... ) { std::cout << " -- unknown failure count"; }
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << C::testInfo << "FINISHED" << resetStyle << ": " << name << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( ... )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
failed= true;
|
|
||||||
std::cout << C::testFail << "FAILURE" << resetStyle << ": " << name;
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch( const TestFailureException &fail ) { std::cout << " -- " << fail.failureCount << " failures."; }
|
|
||||||
catch( ... ) { std::cout << " -- unknown failure count"; }
|
|
||||||
std::cout << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user