Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Tweaked indentation of errors and test lists

Commit
11381c146cce97465e52ee5ff959157fb1af658f
Author
Phil Nash ·
Parents
27cae858d0c0

Files · Download .tar.gz

Changes

 include/catch_runner.hpp          |  5 ++++-
 include/internal/catch_config.hpp | 30 ++++++++++++++++--------------
 include/internal/catch_list.hpp   | 11 ++++++++---
 3 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp
index 586a3823..6127c36f 100644
--- a/include/catch_runner.hpp
+++ b/include/catch_runner.hpp
@@ -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)();
             }
diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp
index 87e4d552..184649ef 100644
--- a/include/internal/catch_config.hpp
+++ b/include/internal/catch_config.hpp
@@ -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() {
diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp
index 0be1c5ab..6108f36d 100644
--- a/include/internal/catch_list.hpp
+++ b/include/internal/catch_list.hpp
@@ -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;