Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhil Nash2013-01-15 08:43:27 +0000
committerPhil Nash2013-01-15 08:43:27 +0000
commit097282e00e3e7307add6bacd64abdf2e9ea4ccb1 (patch)
treee8773fe4fb6a2837331f7d6210eade67521e0593
parent9beb6f24a17361be026985661ce0fa96cc4da9c8 (diff)
downloadcatch3-097282e00e3e7307add6bacd64abdf2e9ea4ccb1.tar.gz
Merged test case/ sections headers
-rw-r--r--include/reporters/catch_reporter_console.hpp43
1 files changed, 35 insertions, 8 deletions
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index 92a8f20a..182c2bd4 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -247,22 +247,49 @@ namespace Catch {
}
}
void lazyPrintTestCaseInfo() {
- printHeader( "Test case", unusedTestCaseInfo->name );
- unusedTestCaseInfo.reset();
+ if( !currentSectionInfo ) {
+ stream << getDashes() << "\n"
+ << "Test case" << ": '" << unusedTestCaseInfo->name << "'\n";
+ stream << getDashes() << std::endl;
+ unusedTestCaseInfo.reset();
+ }
}
void lazyPrintSectionInfo() {
+
std::vector<ThreadedSectionInfo*> sections;
for( ThreadedSectionInfo* section = unusedSectionInfo.get();
- section && !section->printed;
+ section;
section = section->parent.get() )
sections.push_back( section );
- typedef std::vector<ThreadedSectionInfo*>::const_reverse_iterator It;
- for( It it = sections.rbegin(), itEnd = sections.rend(); it != itEnd; ++it ) {
- printHeader( "Section", (*it)->name );
- (*it)->printed = true;
+ // Sections
+ if( !sections.empty() ) {
+ stream << getDashes() << "\n"
+ << "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 ) {