mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-28 07:29:25 +00:00
Shifted some of MockReporter into the impl file file
This commit is contained in:
parent
49e6d536e1
commit
e848a91704
2 changed files with 105 additions and 156 deletions
|
@ -37,7 +37,89 @@ namespace Catch{
|
|||
m_output = oss.str();
|
||||
return result;
|
||||
}
|
||||
|
||||
void MockReporter::Result
|
||||
(
|
||||
const ResultInfo& resultInfo
|
||||
)
|
||||
{
|
||||
if( resultInfo.getResultType() == ResultWas::Ok )
|
||||
return;
|
||||
|
||||
|
||||
switch( resultInfo.getResultType() )
|
||||
{
|
||||
case ResultWas::Info:
|
||||
m_log << "Info";
|
||||
break;
|
||||
case ResultWas::Warning:
|
||||
m_log << "Warning";
|
||||
break;
|
||||
case ResultWas::ExplicitFailure:
|
||||
m_log << "ExplicitFailure";
|
||||
break;
|
||||
case ResultWas::ExpressionFailed:
|
||||
m_log << "ExpressionFailed";
|
||||
break;
|
||||
case ResultWas::Unknown:
|
||||
m_log << "Unknown";
|
||||
break;
|
||||
case ResultWas::ThrewException:
|
||||
m_log << "ThrewException";
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
m_log << "DidntThrowException";
|
||||
break;
|
||||
|
||||
// We shouldn't ever see these
|
||||
case ResultWas::Ok:
|
||||
m_log << "Ok";
|
||||
break;
|
||||
case ResultWas::FailureBit:
|
||||
m_log << "FailureBit";
|
||||
break;
|
||||
case ResultWas::Exception:
|
||||
m_log << "Exception";
|
||||
break;
|
||||
default:
|
||||
m_log << "{unrecognised ResultType enum value}";
|
||||
break;
|
||||
}
|
||||
|
||||
if( resultInfo.hasExpression() )
|
||||
m_log << resultInfo.getExpression();
|
||||
|
||||
if( resultInfo.hasMessage() )
|
||||
m_log << "'" << resultInfo.getMessage() << "'";
|
||||
|
||||
if( resultInfo.hasExpandedExpression() )
|
||||
m_log << resultInfo.getExpandedExpression();
|
||||
}
|
||||
|
||||
void MockReporter::openLabel( const std::string& label, const std::string& arg )
|
||||
{
|
||||
if( shouldRecord( label ) )
|
||||
{
|
||||
m_log << m_indent << "\\" << label;
|
||||
if( !arg.empty() )
|
||||
m_log << " " << arg;
|
||||
m_log << "\n";
|
||||
m_indent += " ";
|
||||
}
|
||||
}
|
||||
|
||||
void MockReporter::closeLabel( const std::string& label, const std::string& arg )
|
||||
{
|
||||
if( shouldRecord( label ) )
|
||||
{
|
||||
m_indent = m_indent.substr( 0, m_indent.size()-1 );
|
||||
m_log << m_indent << "/" << label;
|
||||
if( !arg.empty() )
|
||||
m_log << " " << arg;
|
||||
m_log << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
const std::string MockReporter::recordGroups = "[g]";
|
||||
const std::string MockReporter::recordTestCases = "[tc]";
|
||||
const std::string MockReporter::recordSections =" [s]";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue