mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
Merged test case/ sections headers
This commit is contained in:
parent
9beb6f24a1
commit
097282e00e
@ -247,22 +247,49 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void lazyPrintTestCaseInfo() {
|
void lazyPrintTestCaseInfo() {
|
||||||
printHeader( "Test case", unusedTestCaseInfo->name );
|
if( !currentSectionInfo ) {
|
||||||
unusedTestCaseInfo.reset();
|
stream << getDashes() << "\n"
|
||||||
|
<< "Test case" << ": '" << unusedTestCaseInfo->name << "'\n";
|
||||||
|
stream << getDashes() << std::endl;
|
||||||
|
unusedTestCaseInfo.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void lazyPrintSectionInfo() {
|
void lazyPrintSectionInfo() {
|
||||||
|
|
||||||
std::vector<ThreadedSectionInfo*> sections;
|
std::vector<ThreadedSectionInfo*> sections;
|
||||||
for( ThreadedSectionInfo* section = unusedSectionInfo.get();
|
for( ThreadedSectionInfo* section = unusedSectionInfo.get();
|
||||||
section && !section->printed;
|
section;
|
||||||
section = section->parent.get() )
|
section = section->parent.get() )
|
||||||
sections.push_back( section );
|
sections.push_back( section );
|
||||||
|
|
||||||
typedef std::vector<ThreadedSectionInfo*>::const_reverse_iterator It;
|
// Sections
|
||||||
for( It it = sections.rbegin(), itEnd = sections.rend(); it != itEnd; ++it ) {
|
if( !sections.empty() ) {
|
||||||
printHeader( "Section", (*it)->name );
|
stream << getDashes() << "\n"
|
||||||
(*it)->printed = true;
|
<< "Test case" << ": '" << unusedTestCaseInfo->name << "'\n"
|
||||||
|
<< getDashes() << "\n";
|
||||||
|
|
||||||
|
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;
|
||||||
|
for( It it = sections.rbegin(), itEnd = sections.rend(); it != itEnd; ++it ) {
|
||||||
|
if( it == sections.rbegin() )
|
||||||
|
stream << firstInset;
|
||||||
|
else
|
||||||
|
stream << inset;
|
||||||
|
stream << (*it)->name << "\n";
|
||||||
|
// (*it)->printed = true; // !TBD remove flag?
|
||||||
|
}
|
||||||
|
stream << getDashes() << std::endl;
|
||||||
|
unusedSectionInfo.reset();
|
||||||
}
|
}
|
||||||
unusedSectionInfo.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void printHeader( std::string const& _type, std::string const& _name ) {
|
void printHeader( std::string const& _type, std::string const& _name ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user