diff --git a/projects/SelfTest/ToStringWhich.cpp b/projects/SelfTest/ToStringWhich.cpp index 1d4aa89258..38eaafd293 100644 --- a/projects/SelfTest/ToStringWhich.cpp +++ b/projects/SelfTest/ToStringWhich.cpp @@ -1,15 +1,17 @@ -#include "catch.hpp" /* Demonstrate which version of toString/StringMaker is being used for various types */ +#include struct has_toString { }; struct has_maker {}; struct has_maker_and_toString {}; namespace Catch { + template + struct StringMaker; inline std::string toString( const has_toString& ) { return "toString( has_toString )"; } @@ -30,6 +32,8 @@ namespace Catch { }; } +#include "catch.hpp" + // Call the overload TEST_CASE( "toString( has_toString )", "[toString]" ) { has_toString item; @@ -52,7 +56,7 @@ TEST_CASE( "toString( has_maker_and_toString )", "[toString]" ) { TEST_CASE( "toString( vectors v(1); // This invokes template toString which actually gives us '{ ? }' - REQUIRE( Catch::toString( v ) == "{ {?} }" ); + REQUIRE( Catch::toString(v) == "{ toString( has_toString ) }" ); } TEST_CASE( "toString( vectors v(1); // Note: This invokes the template toString -> StringMaker - REQUIRE( Catch::toString( v ) == "{ StringMaker }" ); + REQUIRE( Catch::toString( v ) == "{ toString( has_maker_and_toString ) }" ); }