Fixed inconsistency in reporting of _FALSE (negated) expressions

This commit is contained in:
Phil Nash
2013-05-17 19:35:33 +01:00
parent 374335fc84
commit d4305377b7
4 changed files with 25 additions and 22 deletions

View File

@@ -48,6 +48,7 @@ namespace Catch {
bool hasExpression() const;
bool hasMessage() const;
std::string getExpression() const;
std::string getExpressionInMacro() const;
bool hasExpandedExpression() const;
std::string getExpandedExpression() const;
std::string getMessage() const;

View File

@@ -21,10 +21,7 @@ namespace Catch {
lineInfo( _lineInfo ),
capturedExpression( _capturedExpression ),
resultDisposition( _resultDisposition )
{
if( shouldNegate( resultDisposition ) )
capturedExpression = "!" + _capturedExpression;
}
{}
AssertionResult::AssertionResult() {}
@@ -58,7 +55,16 @@ namespace Catch {
}
std::string AssertionResult::getExpression() const {
return m_info.capturedExpression;
if( shouldNegate( m_info.resultDisposition ) )
return "!" + m_info.capturedExpression;
else
return m_info.capturedExpression;
}
std::string AssertionResult::getExpressionInMacro() const {
if( m_info.macroName.empty() )
return m_info.capturedExpression;
else
return m_info.macroName + "( " + m_info.capturedExpression + " )";
}
bool AssertionResult::hasExpandedExpression() const {

View File

@@ -191,11 +191,7 @@ namespace Catch {
if( result.hasExpression() ) {
Colour colourGuard( Colour::OriginalExpression );
stream << " ";
if( !result.getTestMacroName().empty() )
stream << result.getTestMacroName() << "( ";
stream << result.getExpression();
if( !result.getTestMacroName().empty() )
stream << " )";
stream << result.getExpressionInMacro();
stream << "\n";
}
}