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,21 +88,23 @@ namespace Catch {
: m_data( data ), : m_data( data ),
m_os( std::cout.rdbuf() ) m_os( std::cout.rdbuf() )
{ {
std::string groupName; if( !data.testsOrTags.empty() ) {
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) { std::string groupName;
if( i != 0 ) for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
groupName += " "; if( i != 0 )
groupName += data.testsOrTags[i]; groupName += " ";
groupName += data.testsOrTags[i];
}
TestCaseFilters filters( groupName );
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
std::string filter = data.testsOrTags[i];
if( startsWith( filter, "[" ) || startsWith( filter, "~[" ) )
filters.addTags( filter );
else
filters.addFilter( TestCaseFilter( filter ) );
}
m_filterSets.push_back( filters );
} }
TestCaseFilters filters( groupName );
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
std::string filter = data.testsOrTags[i];
if( startsWith( filter, "[" ) || startsWith( filter, "~[" ) )
filters.addTags( filter );
else
filters.addFilter( TestCaseFilter( filter ) );
}
m_filterSets.push_back( filters );
} }
virtual ~Config() { virtual ~Config() {

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;