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

LineWrapper can indent first line differently to subsequent lines

- use this to wrap Given/ When/ Then with indent after the :
Commit
4746caacaf3821d39543838d2a4b10b1d9dc94d8
Author
Phil Nash ·
Parents
f186a912d4c5

Files · Download .tar.gz

Changes

 include/internal/catch_console_colour_impl.hpp     |   9 +-
 include/internal/catch_line_wrap.h                 |   7 +-
 include/internal/catch_line_wrap.hpp               |  29 +-
 include/reporters/catch_reporter_console.hpp       |  19 +-
 .../CatchSelfTest => SelfTest}/BDDTests.cpp        |   4 +
 projects/SelfTest/Baselines/approvedResults.txt    | 329 ++++++++++++++-------
 projects/SelfTest/TestMain.cpp                     |   8 +
 .../VS2008/TestCatch/TestCatch/TestCatch.vcproj    |  12 +
 .../CatchSelfTest.xcodeproj/project.pbxproj        |   8 +-
 9 files changed, 294 insertions(+), 131 deletions(-)

diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp
index 188e36d9..938a5363 100644
--- a/include/internal/catch_console_colour_impl.hpp
+++ b/include/internal/catch_console_colour_impl.hpp
@@ -32,10 +32,7 @@ namespace {
             GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
             originalAttributes = csbiInfo.wAttributes;
         }
-        ~Win32ColourImpl() {
-            use( Colour::None );
-        }
-        
+
         virtual void use( Colour::Code _colourCode ) {
             switch( _colourCode ) {
                 case Colour::None:      return setTextAttribute( originalAttributes );
@@ -86,10 +83,6 @@ namespace {
     // https://github.com/philsquared/Catch/pull/131
     class PosixColourImpl : public Detail::IColourImpl {
     public:
-        PosixColourImpl() {
-            use( Colour::None );
-        }
-
         virtual void use( Colour::Code _colourCode ) {
             switch( _colourCode ) {
                 case Colour::None:
diff --git a/include/internal/catch_line_wrap.h b/include/internal/catch_line_wrap.h
index 7cd08055..cfd31df8 100644
--- a/include/internal/catch_line_wrap.h
+++ b/include/internal/catch_line_wrap.h
@@ -18,7 +18,9 @@ namespace Catch {
         LineWrapper();
 
         LineWrapper& setIndent( std::size_t _indent );
+        LineWrapper& setInitialIndent( std::size_t _initalIndent );
         LineWrapper& setRight( std::size_t _right );
+        LineWrapper& setTabChar( char _tabChar );
 
         LineWrapper& wrap( std::string const& _str );
 
@@ -38,12 +40,15 @@ namespace Catch {
         void wrapInternal( std::string const& _str );
         void addLine( const std::string& _line );
         bool isWrapPoint( char c );
+        std::size_t getCurrentIndent() const;
 
-        std::string indent;
         std::size_t right;
         std::size_t nextTab;
         std::size_t tab;
+        std::size_t indent;
+        std::size_t initialIndent;
         std::string wrappableChars;
+        char tabChar;
         int recursionCount;
         std::vector<std::string> lines;
     };
diff --git a/include/internal/catch_line_wrap.hpp b/include/internal/catch_line_wrap.hpp
index bd41d69a..05e9143b 100644
--- a/include/internal/catch_line_wrap.hpp
+++ b/include/internal/catch_line_wrap.hpp
@@ -16,12 +16,19 @@ namespace Catch {
     :   right( CATCH_CONFIG_CONSOLE_WIDTH-1 ),
         nextTab( 0 ),
         tab( 0 ),
+        indent( 0 ),
+        initialIndent( (std::size_t)-1 ), // use indent by default
         wrappableChars( " [({.,/|\\" ),
+        tabChar( '\t' ),
         recursionCount( 0 )
     {}
     
     LineWrapper& LineWrapper::setIndent( std::size_t _indent ) {
-        indent = std::string( _indent, ' ' );
+        indent = _indent;
+        return *this;
+    }
+    LineWrapper& LineWrapper::setInitialIndent( std::size_t _initialIndent ) {
+        initialIndent = _initialIndent;
         return *this;
     }
     LineWrapper& LineWrapper::setRight( std::size_t _right ) {
@@ -33,13 +40,17 @@ namespace Catch {
         wrapInternal( _str );
         return *this;
     }
+    LineWrapper& LineWrapper::setTabChar( char _tabChar ) {
+        tabChar = _tabChar;
+        return *this;
+    }
     bool LineWrapper::isWrapPoint( char c ) {
         return wrappableChars.find( c ) != std::string::npos;
     }
     void LineWrapper::wrapInternal( std::string const& _str ) {
         assert( ++recursionCount < 100 );
 
-        std::size_t width = right - indent.size();
+        std::size_t width = right - getCurrentIndent();
         std::size_t wrapPoint = width-tab;
         for( std::size_t pos = 0; pos < _str.size(); ++pos ) {
             if( _str[pos] == '\n' )
@@ -61,7 +72,7 @@ namespace Catch {
                 }
                 return wrapInternal( _str.substr( wrapPoint ) );
             }
-            if( _str[pos] == '\t' ) {
+            if( _str[pos] == tabChar ) {
                 nextTab = pos;
                 std::string withoutTab = _str.substr( 0, nextTab ) + _str.substr( nextTab+1 );
                 return wrapInternal( withoutTab );
@@ -89,14 +100,18 @@ namespace Catch {
     }
     
     void LineWrapper::addLine( const std::string& _line ) {
-        if( tab > 0 )
-            lines.push_back( indent + std::string( tab, ' ' ) + _line );
-        else
-            lines.push_back( indent + _line );
+        lines.push_back( std::string( tab + getCurrentIndent(), ' ' ) + _line );
         if( nextTab > 0 )
             tab = nextTab;
     }
     
+    std::size_t LineWrapper::getCurrentIndent() const
+    {
+        return (initialIndent != (std::size_t)-1 && lines.empty() )
+            ? initialIndent
+            : indent;
+    }
+    
 } // end namespace Catch
 
 #endif // TWOBLUECUBES_CATCH_LINE_WRAP_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index f1a798f3..cb50436d 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -288,7 +288,8 @@ namespace Catch {
                 if( !sections.empty() ) {                    
                     typedef std::vector<ThreadedSectionInfo*>::const_reverse_iterator It;
                     for( It it = sections.rbegin(), itEnd = sections.rend(); it != itEnd; ++it )
-                        stream << "  " << (*it)->name << "\n";
+                        printUserString( (*it)->name, 2 );
+
                 }
             }
             stream << getDots() << "\n" << std::endl;
@@ -306,10 +307,24 @@ namespace Catch {
             }
             {
                 Colour colourGuard( Colour::Headers );
-                stream << _name << "\n";
+                printUserString( _name );
             }
         }
         
+        // if string has a : in first line will set indent to follow it on
+        // subsequent lines
+        void printUserString( std::string const& _string, std::size_t indent = 0 ) {
+            std::size_t i = _string.find( ": " );
+            if( i != std::string::npos )
+                i+=2;
+            else
+                i = 0;
+            stream << LineWrapper()
+                        .setIndent( indent+i)
+                        .setInitialIndent( indent )
+                        .wrap( _string ) << "\n";
+        }
+        
         void printTotals( const Totals& totals ) {
             if( totals.assertions.total() == 0 ) {
                 stream << "No tests ran";
diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest/BDDTests.cpp b/projects/SelfTest/BDDTests.cpp
similarity index 85%
rename from projects/XCode4/CatchSelfTest/CatchSelfTest/BDDTests.cpp
rename to projects/SelfTest/BDDTests.cpp
index bdde0333..4220c820 100644
--- a/projects/XCode4/CatchSelfTest/CatchSelfTest/BDDTests.cpp
+++ b/projects/SelfTest/BDDTests.cpp
@@ -61,4 +61,8 @@ SCENARIO(   "This is a really long scenario name to see how the list command dea
             "[very long tags][lots][long][tags][verbose]"
             "[one very long tag name that should cause line wrapping writing out using the list command]"
             "[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter]" ) {
+    GIVEN( "A section name that is so long that it cannot fit in a single console width" )
+        WHEN( "The test headers are printed as part of the normal running of the scenario" )
+            THEN( "The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" )
+                SUCCEED("boo!");
 }
diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt
index bd8e6d8f..a4af322e 100644
--- a/projects/SelfTest/Baselines/approvedResults.txt
+++ b/projects/SelfTest/Baselines/approvedResults.txt
@@ -4706,14 +4706,34 @@ with expansion:
   "four" == "four"
 
 -------------------------------------------------------------------------------
-TestMain.cpp:477
+TestMain.cpp:470
+
+Long strings can be wrapped
+  plain string
+  Indent first line differently
+...............................................................................
+
+TestMain.cpp:475:
+PASSED:
+  CHECK( Catch::LineWrapper() .setRight( 10 ) .setIndent( 4 ) .setInitialIndent( 1 ) .wrap( testString ).toString() == " one two\n    three\n    four" )
+with expansion:
+  " one two
+      three
+      four"
+  ==
+  " one two
+      three
+      four"
+
+-------------------------------------------------------------------------------
+TestMain.cpp:485
 
 Long strings can be wrapped
   With newlines
   No wrapping
 ...............................................................................
 
-TestMain.cpp:478:
+TestMain.cpp:486:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 80 ).wrap( testString ).toString() == testString )
 with expansion:
@@ -4723,7 +4743,7 @@ with expansion:
   "one two
   three four"
 
-TestMain.cpp:479:
+TestMain.cpp:487:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 18 ).wrap( testString ).toString() == testString )
 with expansion:
@@ -4733,7 +4753,7 @@ with expansion:
   "one two
   three four"
 
-TestMain.cpp:480:
+TestMain.cpp:488:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 10 ).wrap( testString ).toString() == testString )
 with expansion:
@@ -4744,14 +4764,14 @@ with expansion:
   three four"
 
 -------------------------------------------------------------------------------
-TestMain.cpp:482
+TestMain.cpp:490
 
 Long strings can be wrapped
   With newlines
   Trailing newline
 ...............................................................................
 
-TestMain.cpp:483:
+TestMain.cpp:491:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 10 ).wrap( "abcdef\n" ).toString() == "abcdef\n" )
 with expansion:
@@ -4761,13 +4781,13 @@ with expansion:
   "abcdef
   "
 
-TestMain.cpp:484:
+TestMain.cpp:492:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 6 ).wrap( "abcdef" ).toString() == "abcdef" )
 with expansion:
   "abcdef" == "abcdef"
 
-TestMain.cpp:485:
+TestMain.cpp:493:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 6 ).wrap( "abcdef\n" ).toString() == "abcdef\n" )
 with expansion:
@@ -4778,14 +4798,14 @@ with expansion:
   "
 
 -------------------------------------------------------------------------------
-TestMain.cpp:487
+TestMain.cpp:495
 
 Long strings can be wrapped
   With newlines
   Wrapped once
 ...............................................................................
 
-TestMain.cpp:488:
+TestMain.cpp:496:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" )
 with expansion:
@@ -4797,7 +4817,7 @@ with expansion:
   three
   four"
 
-TestMain.cpp:489:
+TestMain.cpp:497:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" )
 with expansion:
@@ -4809,7 +4829,7 @@ with expansion:
   three
   four"
 
-TestMain.cpp:490:
+TestMain.cpp:498:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 7 ).wrap( testString ).toString() == "one two\nthree\nfour" )
 with expansion:
@@ -4822,14 +4842,14 @@ with expansion:
   four"
 
 -------------------------------------------------------------------------------
-TestMain.cpp:492
+TestMain.cpp:500
 
 Long strings can be wrapped
   With newlines
   Wrapped twice
 ...............................................................................
 
-TestMain.cpp:493:
+TestMain.cpp:501:
 PASSED:
   CHECK( Catch::LineWrapper().setRight( 6 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" )
 with expansion:
@@ -4843,6 +4863,17 @@ with expansion:
   three
   four"
 
+hello
+hello
+-------------------------------------------------------------------------------
+TestMain.cpp:604
+
+Strings can be rendered with colour
+...............................................................................
+
+
+No assertions in test case, 'Strings can be rendered with colour'
+
 -------------------------------------------------------------------------------
 TrickyTests.cpp:32
 
@@ -5161,6 +5192,40 @@ PASSED:
 with expansion:
   true
 
+-------------------------------------------------------------------------------
+VariadicMacrosTests.cpp:12
+
+Anonymous test case 1
+...............................................................................
+
+VariadicMacrosTests.cpp:14:
+PASSED:
+with message:
+  anonymous test case
+
+-------------------------------------------------------------------------------
+VariadicMacrosTests.cpp:17
+
+Test case with one argument
+...............................................................................
+
+VariadicMacrosTests.cpp:19:
+PASSED:
+with message:
+  no assertions
+
+-------------------------------------------------------------------------------
+VariadicMacrosTests.cpp:24
+
+Variadic macros
+  Section with one argument
+...............................................................................
+
+VariadicMacrosTests.cpp:26:
+PASSED:
+with message:
+  no assertions
+
 -------------------------------------------------------------------------------
 BDDTests.cpp:19
 
@@ -5365,50 +5430,25 @@ with expansion:
   0 == 0
 
 -------------------------------------------------------------------------------
-BDDTests.cpp:63
+BDDTests.cpp:66
 
-Scenario: This is a really long scenario name to see how the list command deals with wrapping
+Scenario: This is a really long scenario name to see how the list command
+          deals with wrapping
+     Given: A section name that is so long that it cannot fit in a single
+            console width
+      When: The test headers are printed as part of the normal running of the
+            scenario
+      Then: The, deliberately very long and overly verbose (you see what I did
+            there?) section names must wrap, along with an indent
 ...............................................................................
 
-
-No assertions in test case, 'Scenario: This is a really long scenario name to see how the list command deals with wrapping'
-
--------------------------------------------------------------------------------
-VariadicMacrosTests.cpp:12
-
-Anonymous test case 1
-...............................................................................
-
-VariadicMacrosTests.cpp:14:
+BDDTests.cpp:67:
 PASSED:
 with message:
-  anonymous test case
-
--------------------------------------------------------------------------------
-VariadicMacrosTests.cpp:17
-
-Test case with one argument
-...............................................................................
-
-VariadicMacrosTests.cpp:19:
-PASSED:
-with message:
-  no assertions
-
--------------------------------------------------------------------------------
-VariadicMacrosTests.cpp:24
-
-Variadic macros
-  Section with one argument
-...............................................................................
-
-VariadicMacrosTests.cpp:26:
-PASSED:
-with message:
-  no assertions
+  boo!
 
 ===============================================================================
-108 test cases - 48 failed (697 assertions - 105 failed)
+109 test cases - 48 failed (699 assertions - 105 failed)
 
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -5729,7 +5769,7 @@ with expansion:
 13 test cases - 3 failed (40 assertions - 4 failed)
 
 <testsuites>
-  <testsuite name="~dummy" errors="9" failures="77" tests="697" hostname="tbd" time="tbd" timestamp="tbd">
+  <testsuite name="~dummy" errors="9" failures="77" tests="699" hostname="tbd" time="tbd" timestamp="tbd">
     <testcase classname="global" name="./succeeding/Approx/simple" time="tbd"/>
     <testcase classname="global" name="./succeeding/Approx/epsilon" time="tbd"/>
     <testcase classname="global" name="./succeeding/Approx/float" time="tbd"/>
@@ -6136,6 +6176,12 @@ An error
     <testcase classname="global" name="selftest/option parsers" time="tbd"/>
     <testcase classname="global" name="selftest/tags" time="tbd"/>
     <testcase classname="global" name="Long strings can be wrapped" time="tbd"/>
+    <testcase classname="global" name="Strings can be rendered with colour" time="tbd">
+      <system-out>
+hello
+hello
+      </system-out>
+    </testcase>
     <testcase classname="global" name="./succeeding/Tricky/std::pair" time="tbd"/>
     <testcase classname="global" name="./inprogress/failing/Tricky/trailing expression" time="tbd">
       <warning type="WARN">
@@ -6168,12 +6214,12 @@ TrickyTests.cpp:106
     <testcase classname="global" name="./succeeding/unimplemented static bool" time="tbd"/>
     <testcase classname="global" name="./succeeding/SafeBool" time="tbd"/>
     <testcase classname="global" name="Assertions then sections" time="tbd"/>
-    <testcase classname="global" name="Scenario: Do that thing with the thing" time="tbd"/>
-    <testcase classname="global" name="Scenario: Vector resizing affects size and capacity" time="tbd"/>
-    <testcase classname="global" name="Scenario: This is a really long scenario name to see how the list command deals with wrapping" time="tbd"/>
     <testcase classname="global" name="Anonymous test case 1" time="tbd"/>
     <testcase classname="global" name="Test case with one argument" time="tbd"/>
     <testcase classname="global" name="Variadic macros" time="tbd"/>
+    <testcase classname="global" name="Scenario: Do that thing with the thing" time="tbd"/>
+    <testcase classname="global" name="Scenario: Vector resizing affects size and capacity" time="tbd"/>
+    <testcase classname="global" name="Scenario: This is a really long scenario name to see how the list command deals with wrapping" time="tbd"/>
   </testsuite>
   <system-out>
 Message from section one
@@ -6187,6 +6233,9 @@ Some information
 Message from section one
 Message from section two
 Some information
+
+hello
+hello
   </system-out>
   <system-err>
 An error
@@ -11262,12 +11311,32 @@ TestMain.cpp" line="468">
         </Section>
         <OverallResults successes="5" failures="0"/>
       </Section>
+      <Section name="plain string">
+        <Section name="Indent first line differently">
+TestMain.cpp" line="475">
+            <Original>
+              Catch::LineWrapper() .setRight( 10 ) .setIndent( 4 ) .setInitialIndent( 1 ) .wrap( testString ).toString() == &quot; one two\n    three\n    four&quot;
+            </Original>
+            <Expanded>
+              &quot; one two
+    three
+    four&quot;
+==
+&quot; one two
+    three
+    four&quot;
+            </Expanded>
+          </Expression>
+          <OverallResults successes="1" failures="0"/>
+        </Section>
+        <OverallResults successes="1" failures="0"/>
+      </Section>
       <Section name="plain string">
         <OverallResults successes="0" failures="0"/>
       </Section>
       <Section name="With newlines">
         <Section name="No wrapping">
-TestMain.cpp" line="478">
+TestMain.cpp" line="486">
             <Original>
               Catch::LineWrapper().setRight( 80 ).wrap( testString ).toString() == testString
             </Original>
@@ -11279,7 +11348,7 @@ three four&quot;
 three four&quot;
             </Expanded>
           </Expression>
-TestMain.cpp" line="479">
+TestMain.cpp" line="487">
             <Original>
               Catch::LineWrapper().setRight( 18 ).wrap( testString ).toString() == testString
             </Original>
@@ -11291,7 +11360,7 @@ three four&quot;
 three four&quot;
             </Expanded>
           </Expression>
-TestMain.cpp" line="480">
+TestMain.cpp" line="488">
             <Original>
               Catch::LineWrapper().setRight( 10 ).wrap( testString ).toString() == testString
             </Original>
@@ -11309,7 +11378,7 @@ three four&quot;
       </Section>
       <Section name="With newlines">
         <Section name="Trailing newline">
-TestMain.cpp" line="483">
+TestMain.cpp" line="491">
             <Original>
               Catch::LineWrapper().setRight( 10 ).wrap( &quot;abcdef\n&quot; ).toString() == &quot;abcdef\n&quot;
             </Original>
@@ -11321,7 +11390,7 @@ TestMain.cpp" line="483">
 &quot;
             </Expanded>
           </Expression>
-TestMain.cpp" line="484">
+TestMain.cpp" line="492">
             <Original>
               Catch::LineWrapper().setRight( 6 ).wrap( &quot;abcdef&quot; ).toString() == &quot;abcdef&quot;
             </Original>
@@ -11329,7 +11398,7 @@ TestMain.cpp" line="484">
               &quot;abcdef&quot; == &quot;abcdef&quot;
             </Expanded>
           </Expression>
-TestMain.cpp" line="485">
+TestMain.cpp" line="493">
             <Original>
               Catch::LineWrapper().setRight( 6 ).wrap( &quot;abcdef\n&quot; ).toString() == &quot;abcdef\n&quot;
             </Original>
@@ -11347,7 +11416,7 @@ TestMain.cpp" line="485">
       </Section>
       <Section name="With newlines">
         <Section name="Wrapped once">
-TestMain.cpp" line="488">
+TestMain.cpp" line="496">
             <Original>
               Catch::LineWrapper().setRight( 9 ).wrap( testString ).toString() == &quot;one two\nthree\nfour&quot;
             </Original>
@@ -11361,7 +11430,7 @@ three
 four&quot;
             </Expanded>
           </Expression>
-TestMain.cpp" line="489">
+TestMain.cpp" line="497">
             <Original>
               Catch::LineWrapper().setRight( 8 ).wrap( testString ).toString() == &quot;one two\nthree\nfour&quot;
             </Original>
@@ -11375,7 +11444,7 @@ three
 four&quot;
             </Expanded>
           </Expression>
-TestMain.cpp" line="490">
+TestMain.cpp" line="498">
             <Original>
               Catch::LineWrapper().setRight( 7 ).wrap( testString ).toString() == &quot;one two\nthree\nfour&quot;
             </Original>
@@ -11395,7 +11464,7 @@ four&quot;
       </Section>
       <Section name="With newlines">
         <Section name="Wrapped twice">
-TestMain.cpp" line="493">
+TestMain.cpp" line="501">
             <Original>
               Catch::LineWrapper().setRight( 6 ).wrap( testString ).toString() == &quot;one\ntwo\nthree\nfour&quot;
             </Original>
@@ -11417,6 +11486,9 @@ four&quot;
       </Section>
       <OverallResult success="true"/>
     </TestCase>
+    <TestCase name="Strings can be rendered with colour">
+      <OverallResult success="true"/>
+    </TestCase>
     <TestCase name="./succeeding/Tricky/std::pair">
 TrickyTests.cpp" line="37">
         <Original>
@@ -11705,6 +11777,18 @@ TrickyTests.cpp" line="335">
       </Section>
       <OverallResult success="true"/>
     </TestCase>
+    <TestCase name="Anonymous test case 1">
+      <OverallResult success="true"/>
+    </TestCase>
+    <TestCase name="Test case with one argument">
+      <OverallResult success="true"/>
+    </TestCase>
+    <TestCase name="Variadic macros">
+      <Section name="Section with one argument">
+        <OverallResults successes="1" failures="0"/>
+      </Section>
+      <OverallResult success="true"/>
+    </TestCase>
     <TestCase name="Scenario: Do that thing with the thing">
       <Section name="   Given: This stuff exists">
         <Section name="    When: I do this">
@@ -11911,23 +11995,20 @@ BDDTests.cpp" line="54">
       <OverallResult success="true"/>
     </TestCase>
     <TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping">
-      <OverallResult success="true"/>
-    </TestCase>
-    <TestCase name="Anonymous test case 1">
-      <OverallResult success="true"/>
-    </TestCase>
-    <TestCase name="Test case with one argument">
-      <OverallResult success="true"/>
-    </TestCase>
-    <TestCase name="Variadic macros">
-      <Section name="Section with one argument">
+      <Section name="   Given: A section name that is so long that it cannot fit in a single console width">
+        <Section name="    When: The test headers are printed as part of the normal running of the scenario">
+          <Section name="    Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent">
+            <OverallResults successes="1" failures="0"/>
+          </Section>
+          <OverallResults successes="1" failures="0"/>
+        </Section>
         <OverallResults successes="1" failures="0"/>
       </Section>
       <OverallResult success="true"/>
     </TestCase>
-    <OverallResults successes="592" failures="105"/>
+    <OverallResults successes="594" failures="105"/>
   </Group>
-  <OverallResults successes="592" failures="105"/>
+  <OverallResults successes="594" failures="105"/>
 </Catch>
 [Started testing: CatchSelfTest]
 [Started group: '~dummy']
@@ -13389,21 +13470,35 @@ TestMain.cpp:468: wrapper[3] == "four" succeeded for: "four" == "four"
 
 [End of section: 'plain string' All 5 assertions passed]
 
+[Started section: 'plain string']
+[Started section: 'Indent first line differently']
+TestMain.cpp:475: Catch::LineWrapper() .setRight( 10 ) .setIndent( 4 ) .setInitialIndent( 1 ) .wrap( testString ).toString() == " one two\n    three\n    four" succeeded for:
+	" one two
+    three
+    four"
+==
+" one two
+    three
+    four"
+[End of section: 'Indent first line differently' 1 assertion passed]
+
+[End of section: 'plain string' 1 assertion passed]
+
 [Started section: 'With newlines']
 [Started section: 'No wrapping']
-TestMain.cpp:478: Catch::LineWrapper().setRight( 80 ).wrap( testString ).toString() == testString succeeded for:
+TestMain.cpp:486: Catch::LineWrapper().setRight( 80 ).wrap( testString ).toString() == testString succeeded for:
 	"one two
 three four"
 ==
 "one two
 three four"
-TestMain.cpp:479: Catch::LineWrapper().setRight( 18 ).wrap( testString ).toString() == testString succeeded for:
+TestMain.cpp:487: Catch::LineWrapper().setRight( 18 ).wrap( testString ).toString() == testString succeeded for:
 	"one two
 three four"
 ==
 "one two
 three four"
-TestMain.cpp:480: Catch::LineWrapper().setRight( 10 ).wrap( testString ).toString() == testString succeeded for:
+TestMain.cpp:488: Catch::LineWrapper().setRight( 10 ).wrap( testString ).toString() == testString succeeded for:
 	"one two
 three four"
 ==
@@ -13415,13 +13510,13 @@ three four"
 
 [Started section: 'With newlines']
 [Started section: 'Trailing newline']
-TestMain.cpp:483: Catch::LineWrapper().setRight( 10 ).wrap( "abcdef\n" ).toString() == "abcdef\n" succeeded for: "abcdef
+TestMain.cpp:491: Catch::LineWrapper().setRight( 10 ).wrap( "abcdef\n" ).toString() == "abcdef\n" succeeded for: "abcdef
 "
 ==
 "abcdef
 "
-TestMain.cpp:484: Catch::LineWrapper().setRight( 6 ).wrap( "abcdef" ).toString() == "abcdef" succeeded for: "abcdef" == "abcdef"
-TestMain.cpp:485: Catch::LineWrapper().setRight( 6 ).wrap( "abcdef\n" ).toString() == "abcdef\n" succeeded for: "abcdef
+TestMain.cpp:492: Catch::LineWrapper().setRight( 6 ).wrap( "abcdef" ).toString() == "abcdef" succeeded for: "abcdef" == "abcdef"
+TestMain.cpp:493: Catch::LineWrapper().setRight( 6 ).wrap( "abcdef\n" ).toString() == "abcdef\n" succeeded for: "abcdef
 "
 ==
 "abcdef
@@ -13432,7 +13527,7 @@ TestMain.cpp:485: Catch::LineWrapper().setRight( 6 ).wrap( "abcdef\n" ).toString
 
 [Started section: 'With newlines']
 [Started section: 'Wrapped once']
-TestMain.cpp:488: Catch::LineWrapper().setRight( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" succeeded for:
+TestMain.cpp:496: Catch::LineWrapper().setRight( 9 ).wrap( testString ).toString() == "one two\nthree\nfour" succeeded for:
 	"one two
 three
 four"
@@ -13440,7 +13535,7 @@ four"
 "one two
 three
 four"
-TestMain.cpp:489: Catch::LineWrapper().setRight( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" succeeded for:
+TestMain.cpp:497: Catch::LineWrapper().setRight( 8 ).wrap( testString ).toString() == "one two\nthree\nfour" succeeded for:
 	"one two
 three
 four"
@@ -13448,7 +13543,7 @@ four"
 "one two
 three
 four"
-TestMain.cpp:490: Catch::LineWrapper().setRight( 7 ).wrap( testString ).toString() == "one two\nthree\nfour" succeeded for:
+TestMain.cpp:498: Catch::LineWrapper().setRight( 7 ).wrap( testString ).toString() == "one two\nthree\nfour" succeeded for:
 	"one two
 three
 four"
@@ -13462,7 +13557,7 @@ four"
 
 [Started section: 'With newlines']
 [Started section: 'Wrapped twice']
-TestMain.cpp:493: Catch::LineWrapper().setRight( 6 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" succeeded for:
+TestMain.cpp:501: Catch::LineWrapper().setRight( 6 ).wrap( testString ).toString() == "one\ntwo\nthree\nfour" succeeded for:
 	"one
 two
 three
@@ -13476,7 +13571,15 @@ four"
 
 [End of section: 'With newlines' 1 assertion passed]
 
-[Finished: 'Long strings can be wrapped' All tests passed (31 assertions in 1 test case)]
+[Finished: 'Long strings can be wrapped' All tests passed (32 assertions in 1 test case)]
+hello
+hello
+
+[Running: Strings can be rendered with colour]
+
+No assertions in test case, 'Strings can be rendered with colour'
+
+[Finished: 'Strings can be rendered with colour' 1 test case failed (1 assertion failed)]
 
 [Running: ./succeeding/Tricky/std::pair]
 TrickyTests.cpp:37: (std::pair<int, int>( 1, 2 )) == aNicePair succeeded for: std::pair( 1, 2 ) == std::pair( 1, 2 )
@@ -13579,6 +13682,24 @@ TrickyTests.cpp:335: Catch::isTrue( true ) succeeded for: true
 
 [Finished: 'Assertions then sections' All tests passed (6 assertions in 1 test case)]
 
+[Running: Anonymous test case 1]
+VariadicMacrosTests.cpp:14:  succeeded
+[with message: anonymous test case]
+[Finished: 'Anonymous test case 1' All tests passed (1 assertion in 1 test case)]
+
+[Running: Test case with one argument]
+VariadicMacrosTests.cpp:19:  succeeded
+[with message: no assertions]
+[Finished: 'Test case with one argument' All tests passed (1 assertion in 1 test case)]
+
+[Running: Variadic macros]
+[Started section: 'Section with one argument']
+VariadicMacrosTests.cpp:26:  succeeded
+[with message: no assertions]
+[End of section: 'Section with one argument' 1 assertion passed]
+
+[Finished: 'Variadic macros' All tests passed (1 assertion in 1 test case)]
+
 [Running: Scenario: Do that thing with the thing]
 [Started section: '   Given: This stuff exists']
 [Started section: '    When: I do this']
@@ -13660,32 +13781,22 @@ BDDTests.cpp:54: v.size() == 0 succeeded for: 0 == 0
 [Finished: 'Scenario: Vector resizing affects size and capacity' All tests passed (15 assertions in 1 test case)]
 
 [Running: Scenario: This is a really long scenario name to see how the list command deals with wrapping]
+[Started section: '   Given: A section name that is so long that it cannot fit in a single console width']
+[Started section: '    When: The test headers are printed as part of the normal running of the scenario']
+[Started section: '    Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent']
+BDDTests.cpp:67:  succeeded
+[with message: boo!]
+[End of section: '    Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent' 1 assertion passed]
 
-No assertions in test case, 'Scenario: This is a really long scenario name to see how the list command deals with wrapping'
-
-[Finished: 'Scenario: This is a really long scenario name to see how the list command deals with wrapping' 1 test case failed (1 assertion failed)]
-
-[Running: Anonymous test case 1]
-VariadicMacrosTests.cpp:14:  succeeded
-[with message: anonymous test case]
-[Finished: 'Anonymous test case 1' All tests passed (1 assertion in 1 test case)]
-
-[Running: Test case with one argument]
-VariadicMacrosTests.cpp:19:  succeeded
-[with message: no assertions]
-[Finished: 'Test case with one argument' All tests passed (1 assertion in 1 test case)]
+[End of section: '    When: The test headers are printed as part of the normal running of the scenario' 1 assertion passed]
 
-[Running: Variadic macros]
-[Started section: 'Section with one argument']
-VariadicMacrosTests.cpp:26:  succeeded
-[with message: no assertions]
-[End of section: 'Section with one argument' 1 assertion passed]
+[End of section: '   Given: A section name that is so long that it cannot fit in a single console width' 1 assertion passed]
 
-[Finished: 'Variadic macros' All tests passed (1 assertion in 1 test case)]
-[End of group: '~dummy'. 48 of 108 test cases failed (105 of 697 assertions failed)]
+[Finished: 'Scenario: This is a really long scenario name to see how the list command deals with wrapping' All tests passed (1 assertion in 1 test case)]
+[End of group: '~dummy'. 48 of 109 test cases failed (105 of 699 assertions failed)]
 
 
-[Testing completed. 48 of 108 test cases failed (105 of 697 assertions failed)]
+[Testing completed. 48 of 109 test cases failed (105 of 699 assertions failed)]
 
 [Started testing: CatchSelfTest]
 [Started group: '~dummy']
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 579caae5..e1a44be0 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -467,6 +467,14 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) {
             CHECK( wrapper[2] == "three" );
             CHECK( wrapper[3] == "four" );
         }
+        SECTION( "Indent first line differently", "" ) {
+            CHECK( Catch::LineWrapper()
+                        .setRight( 10 )
+                        .setIndent( 4 )
+                        .setInitialIndent( 1 )
+                        .wrap( testString ).toString() == " one two\n    three\n    four" );
+        }
+        
     }
     
     SECTION( "With newlines", "" ) {
diff --git a/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj b/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj
index 591fd8cc..c094bb38 100644
--- a/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj
+++ b/projects/VS2008/TestCatch/TestCatch/TestCatch.vcproj
@@ -343,6 +343,14 @@
 		<Filter

 			Name="TestCases"

 			>

+			<File

+				RelativePath="..\..\..\SelfTest\ApproxTests.cpp"

+				>

+			</File>

+			<File

+				RelativePath="..\..\..\SelfTest\BDDTests.cpp"

+				>

+			</File>

 			<File

 				RelativePath="..\..\..\SelfTest\catch_self_test.cpp"

 				>

@@ -375,6 +383,10 @@
 				RelativePath="..\..\..\SelfTest\TrickyTests.cpp"

 				>

 			</File>

+			<File

+				RelativePath="..\..\..\SelfTest\VariadicMacrosTests.cpp"

+				>

+			</File>

 		</Filter>

 		<File

 			RelativePath=".\ReadMe.txt"

diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
index 8f799bb5..4f1a6a1e 100644
--- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
+++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
 
 /* Begin PBXBuildFile section */
 		266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */; };
+		266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266ECD73170F3C620030D735 /* BDDTests.cpp */; };
 		26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
 		2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */; };
 		4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
@@ -29,7 +30,6 @@
 		4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */; };
 		4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C36149B3D9E00DB3EAA /* TrickyTests.cpp */; };
 		4A8E4DD2160A352200194CBD /* catch_tags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A8E4DD0160A352200194CBD /* catch_tags.cpp */; };
-		4AA7FF4315F3E89E009AD7F9 /* BDDTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AA7FF4115F3E89D009AD7F9 /* BDDTests.cpp */; };
 		4AB3D99D1616216500C9A0F8 /* catch_interfaces_testcase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D99C1616216500C9A0F8 /* catch_interfaces_testcase.cpp */; };
 		4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */; };
 		4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */; };
@@ -56,6 +56,7 @@
 
 /* Begin PBXFileReference section */
 		266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VariadicMacrosTests.cpp; path = ../../../SelfTest/VariadicMacrosTests.cpp; sourceTree = "<group>"; };
+		266ECD73170F3C620030D735 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BDDTests.cpp; path = ../../../SelfTest/BDDTests.cpp; sourceTree = "<group>"; };
 		26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = "<group>"; };
 		26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = "<group>"; };
 		26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = "<group>"; };
@@ -137,7 +138,6 @@
 		4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_tostring.hpp; sourceTree = "<group>"; };
 		4A9D84B315599AC900FBB209 /* catch_expressionresult_builder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_expressionresult_builder.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		4AA7B8B4165428BA003155F6 /* catch_version.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_version.hpp; path = ../../../../include/internal/catch_version.hpp; sourceTree = "<group>"; };
-		4AA7FF4115F3E89D009AD7F9 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BDDTests.cpp; sourceTree = "<group>"; };
 		4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_console_colour_impl.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		4AB1C73714F97C1300F31DF7 /* catch_console_colour.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_console_colour.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		4AB3D99C1616216500C9A0F8 /* catch_interfaces_testcase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_testcase.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp; sourceTree = "<group>"; };
@@ -204,6 +204,7 @@
 		4A6D0C40149B3DAB00DB3EAA /* Tests */ = {
 			isa = PBXGroup;
 			children = (
+				266ECD73170F3C620030D735 /* BDDTests.cpp */,
 				4A6D0C36149B3D9E00DB3EAA /* TrickyTests.cpp */,
 				4A6D0C2D149B3D9E00DB3EAA /* ApproxTests.cpp */,
 				4A6D0C2F149B3D9E00DB3EAA /* ClassTests.cpp */,
@@ -212,7 +213,6 @@
 				4A6D0C32149B3D9E00DB3EAA /* GeneratorTests.cpp */,
 				4A6D0C33149B3D9E00DB3EAA /* MessageTests.cpp */,
 				4A6D0C34149B3D9E00DB3EAA /* MiscTests.cpp */,
-				4AA7FF4115F3E89D009AD7F9 /* BDDTests.cpp */,
 				266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */,
 			);
 			name = Tests;
@@ -464,7 +464,6 @@
 				4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */,
 				4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */,
 				4AE1840B14EE4F230066340D /* catch_self_test.cpp in Sources */,
-				4AA7FF4315F3E89E009AD7F9 /* BDDTests.cpp in Sources */,
 				4A8E4DD2160A352200194CBD /* catch_tags.cpp in Sources */,
 				4AEE032016142F910071E950 /* catch_common.cpp in Sources */,
 				4AEE032316142FC70071E950 /* catch_debugger.cpp in Sources */,
@@ -485,6 +484,7 @@
 				2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */,
 				26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
 				266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */,
+				266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};