mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-02 18:07:59 +00:00
Cleaned up ANSI colour code impl a bit
This commit is contained in:
parent
778f9c4fc7
commit
355b95fda1
4 changed files with 112 additions and 70 deletions
|
@ -184,35 +184,41 @@ namespace Catch {
|
|||
}
|
||||
switch( assertionResult.getResultType() ) {
|
||||
case ResultWas::ThrewException:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " with unexpected";
|
||||
else
|
||||
m_config.stream << "Unexpected";
|
||||
m_config.stream << " exception with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " with unexpected";
|
||||
else
|
||||
m_config.stream << "Unexpected";
|
||||
m_config.stream << " exception with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " because no exception was thrown where one was expected";
|
||||
else
|
||||
m_config.stream << "No exception thrown where one was expected";
|
||||
}
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " because no exception was thrown where one was expected";
|
||||
else
|
||||
m_config.stream << "No exception thrown where one was expected";
|
||||
}
|
||||
break;
|
||||
case ResultWas::Info:
|
||||
streamVariableLengthText( "info", assertionResult.getMessage() );
|
||||
{
|
||||
TextColour colour( TextColour::ReconstructedExpression );
|
||||
streamVariableLengthText( "info", assertionResult.getMessage() );
|
||||
}
|
||||
break;
|
||||
case ResultWas::Warning:
|
||||
streamVariableLengthText( "warning", assertionResult.getMessage() );
|
||||
{
|
||||
TextColour colour( TextColour::ReconstructedExpression );
|
||||
streamVariableLengthText( "warning", assertionResult.getMessage() );
|
||||
}
|
||||
break;
|
||||
case ResultWas::ExplicitFailure:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
m_config.stream << "failed with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
m_config.stream << "failed with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
break;
|
||||
case ResultWas::Unknown: // These cases are here to prevent compiler warnings
|
||||
case ResultWas::Ok:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue