mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Fixed inconsistency in reporting of _FALSE (negated) expressions
This commit is contained in:
@@ -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;
|
||||
|
@@ -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 {
|
||||
|
@@ -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";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user