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

Build 37

- string matchers work with NULLs
- removed stray CATCH_CONFIG_SFINAE for GCC 3
Commit
d0d4d93a6be52fcb33cfeeb6dc10c26d4599a3ce
Author
Phil Nash ·
Parents
06548a5b6164

Files · Download .tar.gz

Changes

 README.md                                       |  2 +-
 include/internal/catch_version.hpp              |  2 +-
 projects/SelfTest/Baselines/approvedResults.txt | 44 ++++++++++++++++++++-----
 single_include/catch.hpp                        | 39 +++++++++++++++++-----
 4 files changed, 69 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md
index 9c4ca2cd..c832139a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 ![catch logo](https://raw.github.com/philsquared/Catch/Integration/catch-logo-small.png)
 
-## CATCH v0.9 build 36 (integration branch)
+## CATCH v0.9 build 37 (integration branch)
 An automated test framework for C, C++ and Objective-C.
 
 This branch may contain code that is experimental or not yet fully tested.
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index 05478a72..6fcf51a3 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -13,7 +13,7 @@
 namespace Catch {
 
     // These numbers are maintained by a script
-    Version libraryVersion( 0, 9, 36, "integration" );
+    Version libraryVersion( 0, 9, 37, "integration" );
 }
 
 #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt
index e4441aa0..b68f72f1 100644
--- a/projects/SelfTest/Baselines/approvedResults.txt
+++ b/projects/SelfTest/Baselines/approvedResults.txt
@@ -1,6 +1,6 @@
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-CatchSelfTest is a CATCH v0.9 b36 (integration) host application.
+CatchSelfTest is a CATCH v0.9 b37 (integration) host application.
 Run with -? for options
 
 -------------------------------------------------------------------------------
@@ -2759,6 +2759,18 @@ MiscTests.cpp:236: FAILED:
 with expansion:
   "this string contains 'abc' as a substring" equals: "something else"
 
+-------------------------------------------------------------------------------
+string
+-------------------------------------------------------------------------------
+MiscTests.cpp:238
+...............................................................................
+
+MiscTests.cpp:240:
+PASSED:
+  REQUIRE_THAT( "" Equals(__null) )
+with expansion:
+  "" equals: ""
+
 -------------------------------------------------------------------------------
 ./succeeding/matchers/AllOf
 -------------------------------------------------------------------------------
@@ -5531,11 +5543,11 @@ with message:
   boo!
 
 ===============================================================================
-112 test cases - 49 failed (706 assertions - 106 failed)
+113 test cases - 49 failed (707 assertions - 106 failed)
 
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-CatchSelfTest is a CATCH v0.9 b36 (integration) host application.
+CatchSelfTest is a CATCH v0.9 b37 (integration) host application.
 Run with -? for options
 
 -------------------------------------------------------------------------------
@@ -5852,7 +5864,7 @@ with expansion:
 13 test cases - 3 failed (40 assertions - 4 failed)
 
 <testsuites>
-  <testsuite name="~dummy" errors="10" failures="78" tests="706" hostname="tbd" time="tbd" timestamp="tbd">
+  <testsuite name="~dummy" errors="10" failures="78" tests="707" 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"/>
@@ -6276,6 +6288,7 @@ MiscTests.cpp:231
 MiscTests.cpp:236
       </failure>
     </testcase>
+    <testcase classname="global" name="string" time="tbd"/>
     <testcase classname="global" name="./succeeding/matchers/AllOf" time="tbd"/>
     <testcase classname="global" name="./succeeding/matchers/AnyOf" time="tbd"/>
     <testcase classname="global" name="./succeeding/matchers/Equals" time="tbd"/>
@@ -9714,6 +9727,17 @@ MiscTests.cpp" line="236">
       </Expression>
       <OverallResult success="false"/>
     </TestCase>
+    <TestCase name="string">
+MiscTests.cpp" line="240">
+        <Original>
+          &quot;&quot; Equals(__null)
+        </Original>
+        <Expanded>
+          &quot;&quot; equals: &quot;&quot;
+        </Expanded>
+      </Expression>
+      <OverallResult success="true"/>
+    </TestCase>
     <TestCase name="./succeeding/matchers/AllOf">
 MiscTests.cpp" line="244">
         <Original>
@@ -12276,9 +12300,9 @@ BDDTests.cpp" line="54">
       </Section>
       <OverallResult success="true"/>
     </TestCase>
-    <OverallResults successes="600" failures="106"/>
+    <OverallResults successes="601" failures="106"/>
   </Group>
-  <OverallResults successes="600" failures="106"/>
+  <OverallResults successes="601" failures="106"/>
 </Catch>
 [Started testing: CatchSelfTest]
 [Started group: '~dummy']
@@ -13010,6 +13034,10 @@ MiscTests.cpp:236: testStringForMatching() Equals( "something else" ) failed for
 	"this string contains 'abc' as a substring" equals: "something else"
 [Finished: './failing/matchers/Equals' 1 test case failed (1 assertion failed)]
 
+[Running: string]
+MiscTests.cpp:240: "" Equals(__null) succeeded for: "" equals: ""
+[Finished: 'string' All tests passed (1 assertion in 1 test case)]
+
 [Running: ./succeeding/matchers/AllOf]
 MiscTests.cpp:244: testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) succeeded for:
 "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" )
@@ -14119,10 +14147,10 @@ BDDTests.cpp:67:  succeeded
 [End of section: '   Given: A section name that is so long that it cannot fit in a single console width' 1 assertion passed]
 
 [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'. 49 of 112 test cases failed (106 of 706 assertions failed)]
+[End of group: '~dummy'. 49 of 113 test cases failed (106 of 707 assertions failed)]
 
 
-[Testing completed. 49 of 112 test cases failed (106 of 706 assertions failed)]
+[Testing completed. 49 of 113 test cases failed (106 of 707 assertions failed)]
 
 [Started testing: CatchSelfTest]
 [Started group: '~dummy']
diff --git a/single_include/catch.hpp b/single_include/catch.hpp
index 672d9ead..04abb256 100644
--- a/single_include/catch.hpp
+++ b/single_include/catch.hpp
@@ -1,6 +1,6 @@
 /*
- *  CATCH v0.9 build 36 (integration branch)
- *  Generated: 2013-04-22 18:53:02.845247
+ *  CATCH v0.9 build 37 (integration branch)
+ *  Generated: 2013-04-23 08:01:34.500704
  *  ----------------------------------------------------------
  *  This file has been merged from multiple headers. Please don't edit it directly
  *  Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -406,7 +406,7 @@ namespace Catch {
 #if __GNUC__ < 3
 
 #if (__GNUC_MINOR__ >= 96 )
-#define CATCH_CONFIG_SFINAE
+//#define CATCH_CONFIG_SFINAE
 #endif
 
 #elif __GNUC__ >= 3
@@ -3237,6 +3237,9 @@ namespace Matchers {
 
     namespace StdString {
 
+        inline std::string makeString( const std::string& str ) { return str; }
+        inline std::string makeString( const char* str ) { return str ? std::string( str ) : std::string(); }
+
         struct Equals : MatcherImpl<Equals, std::string> {
             Equals( const std::string& str ) : m_str( str ){}
             Equals( const Equals& other ) : m_str( other.m_str ){}
@@ -3328,10 +3331,30 @@ namespace Matchers {
         return Impl::Generic::AnyOf<ExpressionT>().add( m1 ).add( m2 ).add( m3 );
     }
 
-    inline Impl::StdString::Equals      Equals( const std::string& str ){ return Impl::StdString::Equals( str ); }
-    inline Impl::StdString::Contains    Contains( const std::string& substr ){ return Impl::StdString::Contains( substr ); }
-    inline Impl::StdString::StartsWith  StartsWith( const std::string& substr ){ return Impl::StdString::StartsWith( substr ); }
-    inline Impl::StdString::EndsWith    EndsWith( const std::string& substr ){ return Impl::StdString::EndsWith( substr ); }
+    inline Impl::StdString::Equals      Equals( const std::string& str ) {
+        return Impl::StdString::Equals( str );
+    }
+    inline Impl::StdString::Equals      Equals( const char* str ) {
+        return Impl::StdString::Equals( Impl::StdString::makeString( str ) );
+    }
+    inline Impl::StdString::Contains    Contains( const std::string& substr ) {
+        return Impl::StdString::Contains( substr );
+    }
+    inline Impl::StdString::Contains    Contains( const char* substr ) {
+        return Impl::StdString::Contains( Impl::StdString::makeString( substr ) );
+    }
+    inline Impl::StdString::StartsWith  StartsWith( const std::string& substr ) {
+        return Impl::StdString::StartsWith( substr );
+    }
+    inline Impl::StdString::StartsWith  StartsWith( const char* substr ) {
+        return Impl::StdString::StartsWith( Impl::StdString::makeString( substr ) );
+    }
+    inline Impl::StdString::EndsWith    EndsWith( const std::string& substr ) {
+        return Impl::StdString::EndsWith( substr );
+    }
+    inline Impl::StdString::EndsWith    EndsWith( const char* substr ) {
+        return Impl::StdString::EndsWith( Impl::StdString::makeString( substr ) );
+    }
 
 } // namespace Matchers
 
@@ -6172,7 +6195,7 @@ namespace Catch {
 namespace Catch {
 
     // These numbers are maintained by a script
-    Version libraryVersion( 0, 9, 36, "integration" );
+    Version libraryVersion( 0, 9, 37, "integration" );
 }
 
 // #included from: catch_text.hpp