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

Some toString cleanups

Commit
b0545d1f12b5b316d823393060f68c06a320b9b1
Author
Phil Nash ·
Parents
32186db1b03b

Files · Download .tar.gz

Changes

 include/internal/catch_approx.hpp                        | 3 +--
 include/internal/catch_exception_translator_registry.hpp | 2 +-
 include/internal/catch_tostring.h                        | 7 +++----
 include/internal/catch_tostring.hpp                      | 4 ++--
 include/reporters/catch_reporter_junit.hpp               | 2 +-
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/internal/catch_approx.hpp b/include/internal/catch_approx.hpp
index f5dba61a..8b075515 100644
--- a/include/internal/catch_approx.hpp
+++ b/include/internal/catch_approx.hpp
@@ -81,8 +81,7 @@ namespace Detail {
     };
 }
 
-template<>
-inline std::string toString<Detail::Approx>( Detail::Approx const& value ) {
+inline std::string toString( Detail::Approx const& value ) {
     return value.toString();
 }
 
diff --git a/include/internal/catch_exception_translator_registry.hpp b/include/internal/catch_exception_translator_registry.hpp
index a1cc7050..29ddf8e7 100644
--- a/include/internal/catch_exception_translator_registry.hpp
+++ b/include/internal/catch_exception_translator_registry.hpp
@@ -35,7 +35,7 @@ namespace Catch {
                     throw;
                 }
                 @catch (NSException *exception) {
-                    return toString( [exception description] );
+                    return Catch::toString( [exception description] );
                 }
 #else
                 throw;
diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h
index 674533ff..1c30b203 100644
--- a/include/internal/catch_tostring.h
+++ b/include/internal/catch_tostring.h
@@ -219,10 +219,9 @@ std::string toString( std::nullptr_t );
         std::ostringstream oss;
         oss << "{ ";
         if( first != last ) {
-            oss << toString( *first );
-            for( ++first ; first != last ; ++first ) {
-                oss << ", " << toString( *first );
-            }
+            oss << Catch::toString( *first );
+            for( ++first ; first != last ; ++first )
+                oss << ", " << Catch::toString( *first );
         }
         oss << " }";
         return oss.str();
diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp
index 9b234b18..21ee45f7 100644
--- a/include/internal/catch_tostring.hpp
+++ b/include/internal/catch_tostring.hpp
@@ -75,7 +75,7 @@ std::string toString( std::wstring const& value ) {
     s.reserve( value.size() );
     for(size_t i = 0; i < value.size(); ++i )
         s += value[i] <= 0xff ? static_cast<char>( value[i] ) : '?';
-    return toString( s );
+    return Catch::toString( s );
 }
 
 std::string toString( const char* const value ) {
@@ -112,7 +112,7 @@ std::string toString( unsigned long value ) {
 }
 
 std::string toString( unsigned int value ) {
-    return toString( static_cast<unsigned long>( value ) );
+    return Catch::toString( static_cast<unsigned long>( value ) );
 }
 
 template<typename T>
diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp
index 1108794b..f9524aaf 100644
--- a/include/reporters/catch_reporter_junit.hpp
+++ b/include/reporters/catch_reporter_junit.hpp
@@ -135,7 +135,7 @@ namespace Catch {
                     xml.writeAttribute( "classname", className );
                     xml.writeAttribute( "name", name );
                 }
-                xml.writeAttribute( "time", toString( sectionNode.stats.durationInSeconds ) );
+                xml.writeAttribute( "time", Catch::toString( sectionNode.stats.durationInSeconds ) );
 
                 writeAssertions( sectionNode );