mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-04 10:58:06 +00:00
ResultInfo -> AssertionResult filenames and variables
This commit is contained in:
parent
d16955f63a
commit
c597a893fa
15 changed files with 74 additions and 74 deletions
|
@ -159,21 +159,21 @@ namespace Catch {
|
|||
m_sectionSpans.pop_back();
|
||||
}
|
||||
|
||||
virtual void Result( const AssertionResult& resultInfo ) {
|
||||
if( !m_config.includeSuccessfulResults && resultInfo.getResultType() == ResultWas::Ok )
|
||||
virtual void Result( const AssertionResult& assertionResult ) {
|
||||
if( !m_config.includeSuccessfulResults && assertionResult.getResultType() == ResultWas::Ok )
|
||||
return;
|
||||
|
||||
startSpansLazily();
|
||||
|
||||
if( !resultInfo.getFilename().empty() ) {
|
||||
if( !assertionResult.getFilename().empty() ) {
|
||||
TextColour colour( TextColour::FileName );
|
||||
m_config.stream << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
|
||||
m_config.stream << SourceLineInfo( assertionResult.getFilename(), assertionResult.getLine() );
|
||||
}
|
||||
|
||||
if( resultInfo.hasExpression() ) {
|
||||
if( assertionResult.hasExpression() ) {
|
||||
TextColour colour( TextColour::OriginalExpression );
|
||||
m_config.stream << resultInfo.getExpression();
|
||||
if( resultInfo.ok() ) {
|
||||
m_config.stream << assertionResult.getExpression();
|
||||
if( assertionResult.ok() ) {
|
||||
TextColour successColour( TextColour::Success );
|
||||
m_config.stream << " succeeded";
|
||||
}
|
||||
|
@ -182,36 +182,36 @@ namespace Catch {
|
|||
m_config.stream << " failed";
|
||||
}
|
||||
}
|
||||
switch( resultInfo.getResultType() ) {
|
||||
switch( assertionResult.getResultType() ) {
|
||||
case ResultWas::ThrewException:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( resultInfo.hasExpression() )
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " with unexpected";
|
||||
else
|
||||
m_config.stream << "Unexpected";
|
||||
m_config.stream << " exception with message: '" << resultInfo.getMessage() << "'";
|
||||
m_config.stream << " exception with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( resultInfo.hasExpression() )
|
||||
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", resultInfo.getMessage() );
|
||||
streamVariableLengthText( "info", assertionResult.getMessage() );
|
||||
break;
|
||||
case ResultWas::Warning:
|
||||
m_config.stream << "warning:\n'" << resultInfo.getMessage() << "'";
|
||||
m_config.stream << "warning:\n'" << assertionResult.getMessage() << "'";
|
||||
break;
|
||||
case ResultWas::ExplicitFailure:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
m_config.stream << "failed with message: '" << resultInfo.getMessage() << "'";
|
||||
m_config.stream << "failed with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
break;
|
||||
case ResultWas::Unknown: // These cases are here to prevent compiler warnings
|
||||
|
@ -219,8 +219,8 @@ namespace Catch {
|
|||
case ResultWas::FailureBit:
|
||||
case ResultWas::ExpressionFailed:
|
||||
case ResultWas::Exception:
|
||||
if( !resultInfo.hasExpression() ) {
|
||||
if( resultInfo.ok() ) {
|
||||
if( !assertionResult.hasExpression() ) {
|
||||
if( assertionResult.ok() ) {
|
||||
TextColour colour( TextColour::Success );
|
||||
m_config.stream << " succeeded";
|
||||
}
|
||||
|
@ -232,14 +232,14 @@ namespace Catch {
|
|||
break;
|
||||
}
|
||||
|
||||
if( resultInfo.hasExpandedExpression() ) {
|
||||
if( assertionResult.hasExpandedExpression() ) {
|
||||
m_config.stream << " for: ";
|
||||
if( resultInfo.getExpandedExpression().size() > 40 )
|
||||
if( assertionResult.getExpandedExpression().size() > 40 )
|
||||
m_config.stream << "\n";
|
||||
if( resultInfo.getExpandedExpression().size() < 70 )
|
||||
if( assertionResult.getExpandedExpression().size() < 70 )
|
||||
m_config.stream << "\t";
|
||||
TextColour colour( TextColour::ReconstructedExpression );
|
||||
m_config.stream << resultInfo.getExpandedExpression();
|
||||
m_config.stream << assertionResult.getExpandedExpression();
|
||||
}
|
||||
m_config.stream << std::endl;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue