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 ) {
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 );
return (std::numeric_limits<int>::max)();
}

View File

@ -88,21 +88,23 @@ namespace Catch {
: m_data( data ),
m_os( std::cout.rdbuf() )
{
std::string groupName;
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
if( i != 0 )
groupName += " ";
groupName += data.testsOrTags[i];
if( !data.testsOrTags.empty() ) {
std::string groupName;
for( std::size_t i = 0; i < data.testsOrTags.size(); ++i ) {
if( i != 0 )
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() {

View File

@ -56,12 +56,17 @@ namespace Catch {
for( it = allTests.begin(); it != itEnd; ++it ) {
if( matchesFilters( config.filters(), *it ) ) {
matchedTests++;
// !TBD: consider listAs()
Text nameWrapper( it->getTestCaseInfo().name,
TextAttributes().setWidth( maxNameLen ).setIndent(2) );
TextAttributes()
.setWidth( maxNameLen )
.setInitialIndent(2)
.setIndent(4) );
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 ) {
Colour::Code colour = Colour::None;