mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Cleaned up section headers
- and don't reprint test case name
This commit is contained in:
parent
8ec959e936
commit
2771220a41
@ -68,9 +68,11 @@ namespace Catch {
|
|||||||
|
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
if( !m_headerPrintedForThisSection )
|
if( !m_headerPrintedForThisSection )
|
||||||
printTestCaseAndSectionHeader( msg );
|
printSectionHeader( msg );
|
||||||
m_headerPrintedForThisSection = true;
|
m_headerPrintedForThisSection = true;
|
||||||
|
|
||||||
|
msg << result.getSourceInfo() << "\n";
|
||||||
|
|
||||||
switch( result.getResultType() ) {
|
switch( result.getResultType() ) {
|
||||||
case ResultWas::ExpressionFailed:
|
case ResultWas::ExpressionFailed:
|
||||||
msg << "expression failed";
|
msg << "expression failed";
|
||||||
@ -117,8 +119,6 @@ namespace Catch {
|
|||||||
"with expansion:\n" <<
|
"with expansion:\n" <<
|
||||||
" " << result.getExpandedExpression() << "\n";
|
" " << result.getExpandedExpression() << "\n";
|
||||||
}
|
}
|
||||||
msg << "\n" << result.getSourceInfo() << "\n";
|
|
||||||
msg << "---------------------------------------";
|
|
||||||
|
|
||||||
stream << "##teamcity[testFailed"
|
stream << "##teamcity[testFailed"
|
||||||
<< " name='" << escape( currentTestCaseInfo->name )<< "'"
|
<< " name='" << escape( currentTestCaseInfo->name )<< "'"
|
||||||
@ -159,32 +159,27 @@ namespace Catch {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printTestCaseAndSectionHeader( std::ostream& os ) {
|
void printSectionHeader( std::ostream& os ) {
|
||||||
assert( !m_sectionStack.empty() );
|
assert( !m_sectionStack.empty() );
|
||||||
printOpenHeader( os, currentTestCaseInfo->name );
|
|
||||||
|
|
||||||
if( m_sectionStack.size() > 1 ) {
|
if( m_sectionStack.size() > 1 ) {
|
||||||
|
os << getLineOfChars<'-'>() << "\n";
|
||||||
|
|
||||||
std::vector<SectionInfo>::const_iterator
|
std::vector<SectionInfo>::const_iterator
|
||||||
it = m_sectionStack.begin()+1, // Skip first section (test case)
|
it = m_sectionStack.begin()+1, // Skip first section (test case)
|
||||||
itEnd = m_sectionStack.end();
|
itEnd = m_sectionStack.end();
|
||||||
for( ; it != itEnd; ++it )
|
for( ; it != itEnd; ++it )
|
||||||
printHeaderString( os, it->name, 2 );
|
printHeaderString( os, it->name );
|
||||||
|
os << getLineOfChars<'-'>() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
|
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
|
||||||
|
|
||||||
if( !lineInfo.empty() ){
|
if( !lineInfo.empty() )
|
||||||
os << getLineOfChars<'-'>() << "\n";
|
|
||||||
os << lineInfo << "\n";
|
os << lineInfo << "\n";
|
||||||
}
|
|
||||||
os << getLineOfChars<'.'>() << "\n\n";
|
os << getLineOfChars<'.'>() << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void printOpenHeader( std::ostream& os, std::string const& _name ) {
|
|
||||||
os << getLineOfChars<'-'>() << "\n";
|
|
||||||
printHeaderString( os, _name );
|
|
||||||
}
|
|
||||||
|
|
||||||
// if string has a : in first line will set indent to follow it on
|
// if string has a : in first line will set indent to follow it on
|
||||||
// subsequent lines
|
// subsequent lines
|
||||||
void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
|
void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user