mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Some reporter refinements
This commit is contained in:
parent
381fffe07d
commit
0f478a5b10
@ -173,7 +173,11 @@ namespace Catch
|
|||||||
StartSpansLazily();
|
StartSpansLazily();
|
||||||
|
|
||||||
if( !resultInfo.getFilename().empty() )
|
if( !resultInfo.getFilename().empty() )
|
||||||
|
#ifndef __GNUG__
|
||||||
m_config.stream() << resultInfo.getFilename() << "(" << resultInfo.getLine() << "): ";
|
m_config.stream() << resultInfo.getFilename() << "(" << resultInfo.getLine() << "): ";
|
||||||
|
#else
|
||||||
|
m_config.stream() << resultInfo.getFilename() << ":" << resultInfo.getLine() << ": ";
|
||||||
|
#endif
|
||||||
|
|
||||||
if( resultInfo.hasExpression() )
|
if( resultInfo.hasExpression() )
|
||||||
{
|
{
|
||||||
@ -199,7 +203,7 @@ namespace Catch
|
|||||||
m_config.stream() << "No exception thrown where one was expected";
|
m_config.stream() << "No exception thrown where one was expected";
|
||||||
break;
|
break;
|
||||||
case ResultWas::Info:
|
case ResultWas::Info:
|
||||||
m_config.stream() << "info:\n'" << resultInfo.getMessage() << "'";
|
streamVariableLengthText( "info", resultInfo.getMessage() );
|
||||||
break;
|
break;
|
||||||
case ResultWas::Warning:
|
case ResultWas::Warning:
|
||||||
m_config.stream() << "warning:\n'" << resultInfo.getMessage() << "'";
|
m_config.stream() << "warning:\n'" << resultInfo.getMessage() << "'";
|
||||||
@ -238,22 +242,13 @@ namespace Catch
|
|||||||
if( !stdOut.empty() )
|
if( !stdOut.empty() )
|
||||||
{
|
{
|
||||||
StartSpansLazily();
|
StartSpansLazily();
|
||||||
std::string stdOutTrimmed = trim( stdOut );
|
streamVariableLengthText( "stdout", stdOut );
|
||||||
if( stdOutTrimmed.find_first_of( "\r\n" ) == std::string::npos )
|
|
||||||
{
|
|
||||||
m_config.stream() << "[stdout: " << stdOutTrimmed << "]\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_config.stream() << "[stdout] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << stdOutTrimmed << "\n[end of stdout] <<<<<<<<<<<<<<<<<<<<<<<\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !stdErr.empty() )
|
if( !stdErr.empty() )
|
||||||
{
|
{
|
||||||
StartSpansLazily();
|
StartSpansLazily();
|
||||||
m_config.stream() << "[stderr: " << trim( stdErr ) << "]\n";
|
streamVariableLengthText( "stderr", stdErr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_testSpan.emitted )
|
if( m_testSpan.emitted )
|
||||||
@ -311,6 +306,25 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
void streamVariableLengthText
|
||||||
|
(
|
||||||
|
const std::string& prefix,
|
||||||
|
const std::string& text
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::string trimmed = trim( text );
|
||||||
|
if( trimmed.find_first_of( "\r\n" ) == std::string::npos )
|
||||||
|
{
|
||||||
|
m_config.stream() << "[" << prefix << ": " << trimmed << "]\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_config.stream() << "\n[" << prefix << "] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << trimmed
|
||||||
|
<< "\n[end of " << prefix << "] <<<<<<<<<<<<<<<<<<<<<<<<\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const IReporterConfig& m_config;
|
const IReporterConfig& m_config;
|
||||||
|
Loading…
Reference in New Issue
Block a user