Removed all (well, most) of the redundant, ResultBuilder-based, code

This commit is contained in:
Phil Nash 2017-08-09 09:08:33 +01:00
parent 7df290dfc1
commit 8c95a81448
12 changed files with 3 additions and 717 deletions

View file

@ -10,44 +10,15 @@
namespace Catch {
bool DecomposedExpression::isBinaryExpression() const {
return false;
}
void AssertionResultData::negate( bool parenthesize ) {
negated = !negated;
parenthesized = parenthesize;
if( resultType == ResultWas::Ok )
resultType = ResultWas::ExpressionFailed;
else if( resultType == ResultWas::ExpressionFailed )
resultType = ResultWas::Ok;
}
std::string AssertionResultData::reconstructExpression() const {
if( reconstructedExpression.empty() ) {
// Try new LazyExpression first...
if( lazyExpression ) {
// !TBD Use stringstream for now, but rework above to pass stream in
std::ostringstream oss;
oss << lazyExpression;
reconstructedExpression = oss.str();
}
// ... if not, fall back to decomposedExpression
else if( decomposedExpression != nullptr ) {
decomposedExpression->reconstructExpression( reconstructedExpression );
if( parenthesized ) {
reconstructedExpression.insert( 0, 1, '(' );
reconstructedExpression.append( 1, ')' );
}
if( negated ) {
reconstructedExpression.insert( 0, 1, '!' );
}
decomposedExpression = nullptr;
}
}
return reconstructedExpression;
}
@ -115,12 +86,4 @@ namespace Catch {
return m_info.macroName.c_str();
}
void AssertionResult::discardDecomposedExpression() const {
m_resultData.decomposedExpression = nullptr;
}
void AssertionResult::expandDecomposedExpression() const {
m_resultData.reconstructExpression();
}
} // end namespace Catch