Tweaked indentation of errors and test lists

This commit is contained in:
Phil Nash 2013-06-07 19:06:30 +01:00
parent 27cae858d0
commit 11381c146c
3 changed files with 28 additions and 18 deletions

View File

@ -151,7 +151,10 @@ namespace Catch {
} }
catch( std::exception& ex ) { catch( std::exception& ex ) {
std::cerr << "\nError in input:\n" std::cerr << "\nError in input:\n"
<< " " << ex.what() << "\n\n"; << Text( ex.what(), TextAttributes()
.setInitialIndent(2)
.setIndent(4) )
<< "\n\n";
m_cli.usage( std::cout, m_configData.processName ); m_cli.usage( std::cout, m_configData.processName );
return (std::numeric_limits<int>::max)(); return (std::numeric_limits<int>::max)();
} }

View File

@ -88,6 +88,7 @@ namespace Catch {
: m_data( data ), : m_data( data ),
m_os( std::cout.rdbuf() ) m_os( std::cout.rdbuf() )
{ {
if( !data.testsOrTags.empty() ) {
std::string groupName; std::string groupName;
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) { for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
if( i != 0 ) if( i != 0 )
@ -104,6 +105,7 @@ namespace Catch {
} }
m_filterSets.push_back( filters ); m_filterSets.push_back( filters );
} }
}
virtual ~Config() { virtual ~Config() {
m_os.rdbuf( std::cout.rdbuf() ); m_os.rdbuf( std::cout.rdbuf() );

View File

@ -56,12 +56,17 @@ namespace Catch {
for( it = allTests.begin(); it != itEnd; ++it ) { for( it = allTests.begin(); it != itEnd; ++it ) {
if( matchesFilters( config.filters(), *it ) ) { if( matchesFilters( config.filters(), *it ) ) {
matchedTests++; matchedTests++;
// !TBD: consider listAs()
Text nameWrapper( it->getTestCaseInfo().name, Text nameWrapper( it->getTestCaseInfo().name,
TextAttributes().setWidth( maxNameLen ).setIndent(2) ); TextAttributes()
.setWidth( maxNameLen )
.setInitialIndent(2)
.setIndent(4) );
Text tagsWrapper( it->getTestCaseInfo().tagsAsString, Text tagsWrapper( it->getTestCaseInfo().tagsAsString,
TextAttributes().setWidth( maxTagLen ) ); TextAttributes()
.setWidth( maxTagLen )
.setInitialIndent(0)
.setIndent( 2 ) );
for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) { for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
Colour::Code colour = Colour::None; Colour::Code colour = Colour::None;