Dropped "Test case" and "Section" prefixes in test report headers

This commit is contained in:
Phil Nash 2013-01-17 11:47:23 +00:00
parent 2e7d966b76
commit 10e891767f
3 changed files with 581 additions and 656 deletions

View File

@ -238,13 +238,13 @@ namespace Catch {
} }
void lazyPrintGroupInfo() { void lazyPrintGroupInfo() {
if( !unusedGroupInfo->name.empty() && unusedGroupInfo->groupsCounts > 1 ) { if( !unusedGroupInfo->name.empty() && unusedGroupInfo->groupsCounts > 1 ) {
printHeader( "Group", unusedGroupInfo->name ); printHeader( "Group: " + unusedGroupInfo->name );
unusedGroupInfo.reset(); unusedGroupInfo.reset();
} }
} }
void lazyPrintTestCaseInfo() { void lazyPrintTestCaseInfo() {
if( !currentSectionInfo ) { if( !currentSectionInfo ) {
printTestCaseHeader(); printHeader( unusedTestCaseInfo->name );
stream << std::endl; stream << std::endl;
unusedTestCaseInfo.reset(); unusedTestCaseInfo.reset();
} }
@ -259,38 +259,21 @@ namespace Catch {
// Sections // Sections
if( !sections.empty() ) { if( !sections.empty() ) {
printTestCaseHeader(); printHeader( unusedTestCaseInfo->name, false );
std::string firstInset;
std::string inset;
if( sections.size() > 1 ) {
firstInset = "Sections: ";
inset = " ";
}
else {
firstInset = "Section: ";
inset = " ";
}
typedef std::vector<ThreadedSectionInfo*>::const_reverse_iterator It; typedef std::vector<ThreadedSectionInfo*>::const_reverse_iterator It;
for( It it = sections.rbegin(), itEnd = sections.rend(); it != itEnd; ++it ) { for( It it = sections.rbegin(), itEnd = sections.rend(); it != itEnd; ++it )
if( it == sections.rbegin() ) stream << " " << (*it)->name << "\n";
stream << firstInset;
else
stream << inset;
stream << (*it)->name << "\n";
}
stream << getDashes() << "\n" << std::endl; stream << getDashes() << "\n" << std::endl;
unusedSectionInfo.reset(); unusedSectionInfo.reset();
} }
} }
void printTestCaseHeader() { void printHeader( std::string const& _name, bool closed = true ) {
printHeader( "Test case", unusedTestCaseInfo->name );
}
void printHeader( std::string const& _type, std::string const& _name ) {
stream << getDashes() << "\n" stream << getDashes() << "\n"
<< _type << ": '" << _name << "'\n" << _name << "\n";
<< getDashes() << "\n"; if( closed )
stream << getDashes() << "\n";
} }
void printTotals( const Totals& totals ) { void printTotals( const Totals& totals ) {
@ -348,12 +331,12 @@ namespace Catch {
} }
static std::string const& getDashes() { static std::string const& getDashes() {
static const std::string dashes static const std::string dashes
= "----------------------------------------------------------------"; = "-----------------------------------------------------------------";
return dashes; return dashes;
} }
static std::string const& getDoubleDashes() { static std::string const& getDoubleDashes() {
static const std::string doubleDashes static const std::string doubleDashes
= "================================================================"; = "=================================================================";
return doubleDashes; return doubleDashes;
} }

File diff suppressed because it is too large Load Diff