mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Reworked stringification layer, removed Catch::toString
Now the order of stringification checks is 1) StringMaker specialization 2) operator<< toString overloads and specializations have been removed.
This commit is contained in:
@@ -119,7 +119,7 @@ with expansion:
|
||||
|
||||
MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( (*__error()) == 1 )
|
||||
REQUIRE( (*__errno_location ()) == 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
@@ -5873,7 +5873,7 @@ TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( (std::pair<int, int>( 1, 2 )) == aNicePair )
|
||||
with expansion:
|
||||
std::pair( 1, 2 ) == std::pair( 1, 2 )
|
||||
{ 1, 2 } == { 1, 2 }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Pointers can be compared to null
|
||||
@@ -5885,13 +5885,13 @@ ConditionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( p == 0 )
|
||||
with expansion:
|
||||
NULL == 0
|
||||
0 == 0
|
||||
|
||||
ConditionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( p == pNULL )
|
||||
with expansion:
|
||||
NULL == NULL
|
||||
0 == 0
|
||||
|
||||
ConditionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
@@ -8864,7 +8864,7 @@ ToStringPair.cpp:<line number>
|
||||
|
||||
ToStringPair.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" )
|
||||
REQUIRE( ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" )
|
||||
with expansion:
|
||||
"{ { 42, "Arthur" }, { "Ford", 24 } }"
|
||||
==
|
||||
@@ -8880,7 +8880,7 @@ TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( p == 0 )
|
||||
with expansion:
|
||||
NULL == 0
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
random SECTION tests
|
||||
@@ -9078,7 +9078,7 @@ ToStringPair.cpp:<line number>
|
||||
|
||||
ToStringPair.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(value) == "{ 34, \"xyzzy\" }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" )
|
||||
with expansion:
|
||||
"{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
|
||||
|
||||
@@ -9090,7 +9090,7 @@ ToStringPair.cpp:<line number>
|
||||
|
||||
ToStringPair.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( value ) == "{ 34, \"xyzzy\" }" )
|
||||
REQUIRE( ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" )
|
||||
with expansion:
|
||||
"{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
|
||||
|
||||
@@ -9102,7 +9102,7 @@ ToStringPair.cpp:<line number>
|
||||
|
||||
ToStringPair.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( pr ) == "{ { \"green\", 55 } }" )
|
||||
REQUIRE( ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" )
|
||||
with expansion:
|
||||
"{ { "green", 55 } }"
|
||||
==
|
||||
@@ -9119,6 +9119,48 @@ TrickyTests.cpp:<line number>: FAILED:
|
||||
with expansion:
|
||||
"first" == "second"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stringify( has_maker )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" )
|
||||
with expansion:
|
||||
"StringMaker<has_maker>"
|
||||
==
|
||||
"StringMaker<has_maker>"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stringify( has_maker_and_toString )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" )
|
||||
with expansion:
|
||||
"StringMaker<has_maker_and_operator>"
|
||||
==
|
||||
"StringMaker<has_maker_and_operator>"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stringify( has_operator )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" )
|
||||
with expansion:
|
||||
"operator<<( has_operator )"
|
||||
==
|
||||
"operator<<( has_operator )"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
toString on const wchar_t const pointer returns the string contents
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -9167,48 +9209,6 @@ PASSED:
|
||||
with expansion:
|
||||
""wide load"" == ""wide load""
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
toString( has_maker )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( item ) == "StringMaker<has_maker>" )
|
||||
with expansion:
|
||||
"StringMaker<has_maker>"
|
||||
==
|
||||
"StringMaker<has_maker>"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
toString( has_maker_and_toString )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( item ) == "toString( has_maker_and_toString )" )
|
||||
with expansion:
|
||||
"toString( has_maker_and_toString )"
|
||||
==
|
||||
"toString( has_maker_and_toString )"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
toString( has_toString )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( item ) == "toString( has_toString )" )
|
||||
with expansion:
|
||||
"toString( has_toString )"
|
||||
==
|
||||
"toString( has_toString )"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
toString( vectors<has_maker )
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -9217,7 +9217,7 @@ ToStringWhich.cpp:<line number>
|
||||
|
||||
ToStringWhich.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString( v ) == "{ StringMaker<has_maker> }" )
|
||||
REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" )
|
||||
with expansion:
|
||||
"{ StringMaker<has_maker> }"
|
||||
==
|
||||
@@ -9231,13 +9231,13 @@ EnumToString.cpp:<line number>
|
||||
|
||||
EnumToString.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( Catch::toString(e0) == "E2{0}" )
|
||||
CHECK( ::Catch::Detail::stringify(e0) == "E2{0}" )
|
||||
with expansion:
|
||||
"E2{0}" == "E2{0}"
|
||||
|
||||
EnumToString.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( Catch::toString(e1) == "E2{1}" )
|
||||
CHECK( ::Catch::Detail::stringify(e1) == "E2{1}" )
|
||||
with expansion:
|
||||
"E2{1}" == "E2{1}"
|
||||
|
||||
@@ -9249,13 +9249,13 @@ EnumToString.cpp:<line number>
|
||||
|
||||
EnumToString.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( Catch::toString(e0) == "0" )
|
||||
CHECK( ::Catch::Detail::stringify(e0) == "0" )
|
||||
with expansion:
|
||||
"0" == "0"
|
||||
|
||||
EnumToString.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( Catch::toString(e1) == "1" )
|
||||
CHECK( ::Catch::Detail::stringify(e1) == "1" )
|
||||
with expansion:
|
||||
"1" == "1"
|
||||
|
||||
@@ -9267,19 +9267,19 @@ ToStringVector.cpp:<line number>
|
||||
|
||||
ToStringVector.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(vv) == "{ }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" )
|
||||
with expansion:
|
||||
"{ }" == "{ }"
|
||||
|
||||
ToStringVector.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(vv) == "{ 42 }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" )
|
||||
with expansion:
|
||||
"{ 42 }" == "{ 42 }"
|
||||
|
||||
ToStringVector.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(vv) == "{ 42, 250 }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" )
|
||||
with expansion:
|
||||
"{ 42, 250 }" == "{ 42, 250 }"
|
||||
|
||||
@@ -9291,19 +9291,19 @@ ToStringVector.cpp:<line number>
|
||||
|
||||
ToStringVector.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(vv) == "{ }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" )
|
||||
with expansion:
|
||||
"{ }" == "{ }"
|
||||
|
||||
ToStringVector.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(vv) == "{ \"hello\" }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\" }" )
|
||||
with expansion:
|
||||
"{ "hello" }" == "{ "hello" }"
|
||||
|
||||
ToStringVector.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( Catch::toString(vv) == "{ \"hello\", \"world\" }" )
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" )
|
||||
with expansion:
|
||||
"{ "hello", "world" }"
|
||||
==
|
||||
|
@@ -119,7 +119,7 @@ with expansion:
|
||||
|
||||
MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( (*__error()) == 1 )
|
||||
REQUIRE( (*__errno_location ()) == 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
|
@@ -715,13 +715,13 @@ MessageTests.cpp:<line number>
|
||||
TrickyTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="global" name="stringify( has_maker )" time="{duration}"/>
|
||||
<testcase classname="global" name="stringify( has_maker_and_toString )" time="{duration}"/>
|
||||
<testcase classname="global" name="stringify( has_operator )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString on const wchar_t const pointer returns the string contents" time="{duration}"/>
|
||||
<testcase classname="global" name="toString on const wchar_t pointer returns the string contents" time="{duration}"/>
|
||||
<testcase classname="global" name="toString on wchar_t const pointer returns the string contents" time="{duration}"/>
|
||||
<testcase classname="global" name="toString on wchar_t returns the string contents" time="{duration}"/>
|
||||
<testcase classname="global" name="toString( has_maker )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString( has_maker_and_toString )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString( has_toString )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString( vectors<has_maker )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||
|
@@ -128,7 +128,7 @@
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
(*__error()) == 1
|
||||
(*__errno_location ()) == 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 1
|
||||
@@ -6214,7 +6214,7 @@ re>"
|
||||
(std::pair<int, int>( 1, 2 )) == aNicePair
|
||||
</Original>
|
||||
<Expanded>
|
||||
std::pair( 1, 2 ) == std::pair( 1, 2 )
|
||||
{ 1, 2 } == { 1, 2 }
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
@@ -6225,7 +6225,7 @@ re>"
|
||||
p == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
NULL == 0
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
@@ -6233,7 +6233,7 @@ re>"
|
||||
p == pNULL
|
||||
</Original>
|
||||
<Expanded>
|
||||
NULL == NULL
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
@@ -9516,7 +9516,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="pair<pair<int,const char *,pair<std::string,int> > -> toString" tags="[pair][toString]" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Original>
|
||||
Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }"
|
||||
::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ { 42, "Arthur" }, { "Ford", 24 } }"
|
||||
@@ -9532,7 +9532,7 @@ spanner <OverallResult success="true"/>
|
||||
p == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
NULL == 0
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
@@ -9743,7 +9743,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="std::pair<int,const std::string> -> toString" tags="[pair][toString]" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Original>
|
||||
Catch::toString(value) == "{ 34, \"xyzzy\" }"
|
||||
::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
|
||||
@@ -9754,7 +9754,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="std::pair<int,std::string> -> toString" tags="[pair][toString]" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Original>
|
||||
Catch::toString( value ) == "{ 34, \"xyzzy\" }"
|
||||
::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
|
||||
@@ -9765,7 +9765,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="std::vector<std::pair<std::string,int> > -> toString" tags="[pair][toString]" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringPair.cpp" >
|
||||
<Original>
|
||||
Catch::toString( pr ) == "{ { \"green\", 55 } }"
|
||||
::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ { "green", 55 } }"
|
||||
@@ -9786,6 +9786,45 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="stringify( has_maker )" tags="[toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( item ) == "StringMaker<has_maker>"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"StringMaker<has_maker>"
|
||||
==
|
||||
"StringMaker<has_maker>"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="stringify( has_maker_and_toString )" tags="[.][hide][toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"StringMaker<has_maker_and_operator>"
|
||||
==
|
||||
"StringMaker<has_maker_and_operator>"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="stringify( has_operator )" tags="[toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( item ) == "operator<<( has_operator )"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"operator<<( has_operator )"
|
||||
==
|
||||
"operator<<( has_operator )"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="toString on const wchar_t const pointer returns the string contents" tags="[toString]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
@@ -9830,49 +9869,10 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="toString( has_maker )" description="toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
Catch::toString( item ) == "StringMaker<has_maker>"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"StringMaker<has_maker>"
|
||||
==
|
||||
"StringMaker<has_maker>"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="toString( has_maker_and_toString )" tags="[.][hide][toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
Catch::toString( item ) == "toString( has_maker_and_toString )"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"toString( has_maker_and_toString )"
|
||||
==
|
||||
"toString( has_maker_and_toString )"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="toString( has_toString )" tags="[toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
Catch::toString( item ) == "toString( has_toString )"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"toString( has_toString )"
|
||||
==
|
||||
"toString( has_toString )"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="toString( vectors<has_maker )" tags="[toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
Catch::toString( v ) == "{ StringMaker<has_maker> }"
|
||||
::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ StringMaker<has_maker> }"
|
||||
@@ -9885,7 +9885,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="toString(enum w/operator<<)" tags="[enum][toString]" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Original>
|
||||
Catch::toString(e0) == "E2{0}"
|
||||
::Catch::Detail::stringify(e0) == "E2{0}"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"E2{0}" == "E2{0}"
|
||||
@@ -9893,7 +9893,7 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Original>
|
||||
Catch::toString(e1) == "E2{1}"
|
||||
::Catch::Detail::stringify(e1) == "E2{1}"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"E2{1}" == "E2{1}"
|
||||
@@ -9904,7 +9904,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="toString(enum)" tags="[enum][toString]" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Original>
|
||||
Catch::toString(e0) == "0"
|
||||
::Catch::Detail::stringify(e0) == "0"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"0" == "0"
|
||||
@@ -9912,7 +9912,7 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Original>
|
||||
Catch::toString(e1) == "1"
|
||||
::Catch::Detail::stringify(e1) == "1"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"1" == "1"
|
||||
@@ -9923,7 +9923,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="vector<int> -> toString" tags="[toString][vector]" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Original>
|
||||
Catch::toString(vv) == "{ }"
|
||||
::Catch::Detail::stringify(vv) == "{ }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ }" == "{ }"
|
||||
@@ -9931,7 +9931,7 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Original>
|
||||
Catch::toString(vv) == "{ 42 }"
|
||||
::Catch::Detail::stringify(vv) == "{ 42 }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ 42 }" == "{ 42 }"
|
||||
@@ -9939,7 +9939,7 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Original>
|
||||
Catch::toString(vv) == "{ 42, 250 }"
|
||||
::Catch::Detail::stringify(vv) == "{ 42, 250 }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ 42, 250 }" == "{ 42, 250 }"
|
||||
@@ -9950,7 +9950,7 @@ spanner <OverallResult success="true"/>
|
||||
<TestCase name="vector<string> -> toString" tags="[toString][vector]" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Original>
|
||||
Catch::toString(vv) == "{ }"
|
||||
::Catch::Detail::stringify(vv) == "{ }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ }" == "{ }"
|
||||
@@ -9958,7 +9958,7 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Original>
|
||||
Catch::toString(vv) == "{ \"hello\" }"
|
||||
::Catch::Detail::stringify(vv) == "{ \"hello\" }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ "hello" }" == "{ "hello" }"
|
||||
@@ -9966,7 +9966,7 @@ spanner <OverallResult success="true"/>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringVector.cpp" >
|
||||
<Original>
|
||||
Catch::toString(vv) == "{ \"hello\", \"world\" }"
|
||||
::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"{ "hello", "world" }"
|
||||
|
@@ -1,32 +1,28 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
/*
|
||||
TODO: maybe ought to check that user-provided specialisations of
|
||||
Catch::toString also do the right thing
|
||||
*/
|
||||
|
||||
// Enum without user-provided stream operator
|
||||
enum Enum1 { Enum1Value0, Enum1Value1 };
|
||||
|
||||
TEST_CASE( "toString(enum)", "[toString][enum]" ) {
|
||||
Enum1 e0 = Enum1Value0;
|
||||
CHECK( Catch::toString(e0) == "0" );
|
||||
CHECK( ::Catch::Detail::stringify(e0) == "0" );
|
||||
Enum1 e1 = Enum1Value1;
|
||||
CHECK( Catch::toString(e1) == "1" );
|
||||
CHECK( ::Catch::Detail::stringify(e1) == "1" );
|
||||
}
|
||||
|
||||
// Enum with user-provided stream operator
|
||||
enum Enum2 { Enum2Value0, Enum2Value1 };
|
||||
|
||||
inline std::ostream& operator<<( std::ostream& os, Enum2 v ) {
|
||||
std::ostream& operator<<( std::ostream& os, Enum2 v ) {
|
||||
return os << "E2{" << static_cast<int>(v) << "}";
|
||||
}
|
||||
|
||||
TEST_CASE( "toString(enum w/operator<<)", "[toString][enum]" ) {
|
||||
Enum2 e0 = Enum2Value0;
|
||||
CHECK( Catch::toString(e0) == "E2{0}" );
|
||||
CHECK( ::Catch::Detail::stringify(e0) == "E2{0}" );
|
||||
Enum2 e1 = Enum2Value1;
|
||||
CHECK( Catch::toString(e1) == "E2{1}" );
|
||||
CHECK( ::Catch::Detail::stringify(e1) == "E2{1}" );
|
||||
}
|
||||
|
||||
// Enum class without user-provided stream operator
|
||||
@@ -34,15 +30,15 @@ enum class EnumClass1 { EnumClass1Value0, EnumClass1Value1 };
|
||||
|
||||
TEST_CASE( "toString(enum class)", "[toString][enum][enumClass][c++11][.]" ) {
|
||||
EnumClass1 e0 = EnumClass1::EnumClass1Value0;
|
||||
CHECK( Catch::toString(e0) == "0" );
|
||||
CHECK( ::Catch::Detail::stringify(e0) == "0" );
|
||||
EnumClass1 e1 = EnumClass1::EnumClass1Value1;
|
||||
CHECK( Catch::toString(e1) == "1" );
|
||||
CHECK( ::Catch::Detail::stringify(e1) == "1" );
|
||||
}
|
||||
|
||||
// Enum class with user-provided stream operator
|
||||
enum class EnumClass2 : short { EnumClass2Value0, EnumClass2Value1 };
|
||||
|
||||
inline std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) {
|
||||
std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) {
|
||||
switch( static_cast<int>( e2 ) ) {
|
||||
case static_cast<int>( EnumClass2::EnumClass2Value0 ):
|
||||
return os << "E2/V0";
|
||||
@@ -55,11 +51,11 @@ inline std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) {
|
||||
|
||||
TEST_CASE( "toString(enum class w/operator<<)", "[toString][enum][enumClass][c++11][.]" ) {
|
||||
EnumClass2 e0 = EnumClass2::EnumClass2Value0;
|
||||
CHECK( Catch::toString(e0) == "E2/V0" );
|
||||
CHECK( ::Catch::Detail::stringify(e0) == "E2/V0" );
|
||||
EnumClass2 e1 = EnumClass2::EnumClass2Value1;
|
||||
CHECK( Catch::toString(e1) == "E2/V1" );
|
||||
CHECK( ::Catch::Detail::stringify(e1) == "E2/V1" );
|
||||
|
||||
EnumClass2 e3 = static_cast<EnumClass2>(10);
|
||||
CHECK( Catch::toString(e3) == "Unknown enum value 10" );
|
||||
CHECK( ::Catch::Detail::stringify(e3) == "Unknown enum value 10" );
|
||||
}
|
||||
|
||||
|
@@ -144,7 +144,7 @@ CATCH_TRANSLATE_EXCEPTION( CustomStdException& ex )
|
||||
|
||||
CATCH_TRANSLATE_EXCEPTION( double& ex )
|
||||
{
|
||||
return Catch::toString( ex );
|
||||
return Catch::Detail::stringify( ex );
|
||||
}
|
||||
|
||||
TEST_CASE("Non-std exceptions can be translated", "[.][failing][!throws]" )
|
||||
|
@@ -134,5 +134,5 @@ TEST_CASE( "Pointers can be converted to strings", "[messages][.]" )
|
||||
{
|
||||
int p;
|
||||
WARN( "actual address of p: " << &p );
|
||||
WARN( "toString(p): " << Catch::toString( &p ) );
|
||||
WARN( "toString(p): " << ::Catch::Detail::stringify( &p ) );
|
||||
}
|
||||
|
@@ -314,25 +314,25 @@ TEST_CASE( "Tabs and newlines show in output", "[.][whitespace][failing]" ) {
|
||||
|
||||
TEST_CASE( "toString on const wchar_t const pointer returns the string contents", "[toString]" ) {
|
||||
const wchar_t * const s = L"wide load";
|
||||
std::string result = Catch::toString( s );
|
||||
std::string result = ::Catch::Detail::stringify( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on const wchar_t pointer returns the string contents", "[toString]" ) {
|
||||
const wchar_t * s = L"wide load";
|
||||
std::string result = Catch::toString( s );
|
||||
std::string result = ::Catch::Detail::stringify( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on wchar_t const pointer returns the string contents", "[toString]" ) {
|
||||
wchar_t * const s = const_cast<wchar_t* const>( L"wide load" );
|
||||
std::string result = Catch::toString( s );
|
||||
std::string result = ::Catch::Detail::stringify( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) {
|
||||
wchar_t * s = const_cast<wchar_t*>( L"wide load" );
|
||||
std::string result = Catch::toString( s );
|
||||
std::string result = ::Catch::Detail::stringify( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
|
@@ -1,37 +1,19 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
// === Pair ===
|
||||
namespace Catch {
|
||||
// Note: If we put this in the right place in catch_tostring, then
|
||||
// we can make it an overload of Catch::toString
|
||||
template<typename T1, typename T2>
|
||||
struct StringMaker<std::pair<T1,T2> > {
|
||||
static std::string convert( const std::pair<T1,T2>& pair ) {
|
||||
std::ostringstream oss;
|
||||
oss << "{ "
|
||||
<< toString( pair.first )
|
||||
<< ", "
|
||||
<< toString( pair.second )
|
||||
<< " }";
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE( "std::pair<int,std::string> -> toString", "[toString][pair]" ) {
|
||||
std::pair<int,std::string> value( 34, "xyzzy" );
|
||||
REQUIRE( Catch::toString( value ) == "{ 34, \"xyzzy\" }" );
|
||||
REQUIRE( ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" );
|
||||
}
|
||||
|
||||
TEST_CASE( "std::pair<int,const std::string> -> toString", "[toString][pair]" ) {
|
||||
std::pair<int,const std::string> value( 34, "xyzzy" );
|
||||
REQUIRE( Catch::toString(value) == "{ 34, \"xyzzy\" }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" );
|
||||
}
|
||||
|
||||
TEST_CASE( "std::vector<std::pair<std::string,int> > -> toString", "[toString][pair]" ) {
|
||||
std::vector<std::pair<std::string,int> > pr;
|
||||
pr.push_back( std::make_pair("green", 55 ) );
|
||||
REQUIRE( Catch::toString( pr ) == "{ { \"green\", 55 } }" );
|
||||
REQUIRE( ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" );
|
||||
}
|
||||
|
||||
// This is pretty contrived - I figure if this works, anything will...
|
||||
@@ -43,5 +25,5 @@ TEST_CASE( "pair<pair<int,const char *,pair<std::string,int> > -> toString", "[t
|
||||
right_t right( "Ford", 24 );
|
||||
|
||||
std::pair<left_t,right_t> pair( left, right );
|
||||
REQUIRE( Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" );
|
||||
REQUIRE( ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" );
|
||||
}
|
||||
|
@@ -5,42 +5,42 @@
|
||||
TEST_CASE( "tuple<>", "[toString][tuple][c++11][.]" )
|
||||
{
|
||||
typedef std::tuple<> type;
|
||||
CHECK( "{ }" == Catch::toString(type{}) );
|
||||
CHECK( "{ }" == ::Catch::Detail::stringify(type{}) );
|
||||
type value {};
|
||||
CHECK( "{ }" == Catch::toString(value) );
|
||||
CHECK( "{ }" == ::Catch::Detail::stringify(value) );
|
||||
}
|
||||
|
||||
TEST_CASE( "tuple<int>", "[toString][tuple][c++11][.]" )
|
||||
{
|
||||
typedef std::tuple<int> type;
|
||||
CHECK( "{ 0 }" == Catch::toString(type{0}) );
|
||||
CHECK( "{ 0 }" == ::Catch::Detail::stringify(type{0}) );
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE( "tuple<float,int>", "[toString][tuple][c++11][.]" )
|
||||
{
|
||||
typedef std::tuple<float,int> type;
|
||||
CHECK( "1.2f" == Catch::toString(float(1.2)) );
|
||||
CHECK( "{ 1.2f, 0 }" == Catch::toString(type{1.2f,0}) );
|
||||
CHECK( "1.2f" == ::Catch::Detail::stringify(float(1.2)) );
|
||||
CHECK( "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) );
|
||||
}
|
||||
|
||||
TEST_CASE( "tuple<string,string>", "[toString][tuple][c++11][.]" )
|
||||
{
|
||||
typedef std::tuple<std::string,std::string> type;
|
||||
CHECK( "{ \"hello\", \"world\" }" == Catch::toString(type{"hello","world"}) );
|
||||
CHECK( "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) );
|
||||
}
|
||||
|
||||
TEST_CASE( "tuple<tuple<int>,tuple<>,float>", "[toString][tuple][c++11][.]" )
|
||||
{
|
||||
typedef std::tuple<std::tuple<int>,std::tuple<>,float> type;
|
||||
type value { std::tuple<int>{42}, {}, 1.2f };
|
||||
CHECK( "{ { 42 }, { }, 1.2f }" == Catch::toString(value) );
|
||||
CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) );
|
||||
}
|
||||
|
||||
TEST_CASE( "tuple<nullptr,int,const char *>", "[toString][tuple][c++11][.]" )
|
||||
{
|
||||
typedef std::tuple<std::nullptr_t,int,const char *> type;
|
||||
type value { nullptr, 42, "Catch me" };
|
||||
CHECK( "{ nullptr, 42, \"Catch me\" }" == Catch::toString(value) );
|
||||
CHECK( "{ nullptr, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) );
|
||||
}
|
||||
|
||||
|
@@ -6,21 +6,21 @@
|
||||
TEST_CASE( "vector<int> -> toString", "[toString][vector]" )
|
||||
{
|
||||
std::vector<int> vv;
|
||||
REQUIRE( Catch::toString(vv) == "{ }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" );
|
||||
vv.push_back( 42 );
|
||||
REQUIRE( Catch::toString(vv) == "{ 42 }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" );
|
||||
vv.push_back( 250 );
|
||||
REQUIRE( Catch::toString(vv) == "{ 42, 250 }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" );
|
||||
}
|
||||
|
||||
TEST_CASE( "vector<string> -> toString", "[toString][vector]" )
|
||||
{
|
||||
std::vector<std::string> vv;
|
||||
REQUIRE( Catch::toString(vv) == "{ }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" );
|
||||
vv.push_back( "hello" );
|
||||
REQUIRE( Catch::toString(vv) == "{ \"hello\" }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\" }" );
|
||||
vv.push_back( "world" );
|
||||
REQUIRE( Catch::toString(vv) == "{ \"hello\", \"world\" }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" );
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -50,19 +50,19 @@ namespace {
|
||||
|
||||
TEST_CASE( "vector<int,allocator> -> toString", "[toString][vector,allocator][c++11][.]" ) {
|
||||
std::vector<int,minimal_allocator<int> > vv;
|
||||
REQUIRE( Catch::toString(vv) == "{ }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" );
|
||||
vv.push_back( 42 );
|
||||
REQUIRE( Catch::toString(vv) == "{ 42 }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" );
|
||||
vv.push_back( 250 );
|
||||
REQUIRE( Catch::toString(vv) == "{ 42, 250 }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" );
|
||||
}
|
||||
|
||||
TEST_CASE( "vec<vec<string,alloc>> -> toString", "[toString][vector,allocator][c++11][.]" ) {
|
||||
using inner = std::vector<std::string, minimal_allocator<std::string>>;
|
||||
using vector = std::vector<inner>;
|
||||
vector v;
|
||||
REQUIRE( Catch::toString(v) == "{ }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(v) == "{ }" );
|
||||
v.push_back( inner { "hello" } );
|
||||
v.push_back( inner { "world" } );
|
||||
REQUIRE( Catch::toString(v) == "{ { \"hello\" }, { \"world\" } }" );
|
||||
REQUIRE( ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" );
|
||||
}
|
||||
|
@@ -5,67 +5,69 @@
|
||||
*/
|
||||
|
||||
|
||||
struct has_toString { };
|
||||
struct has_operator { };
|
||||
struct has_maker {};
|
||||
struct has_maker_and_toString {};
|
||||
struct has_maker_and_operator {};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const has_operator&) {
|
||||
os << "operator<<( has_operator )";
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const has_maker_and_operator&) {
|
||||
os << "operator<<( has_maker_and_operator )";
|
||||
return os;
|
||||
}
|
||||
|
||||
namespace Catch {
|
||||
inline std::string toString( const has_toString& ) {
|
||||
return "toString( has_toString )";
|
||||
}
|
||||
inline std::string toString( const has_maker_and_toString& ) {
|
||||
return "toString( has_maker_and_toString )";
|
||||
}
|
||||
template<>
|
||||
struct StringMaker<has_maker> {
|
||||
static std::string convert( const has_maker& ) {
|
||||
std::string operator()( const has_maker& ) {
|
||||
return "StringMaker<has_maker>";
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct StringMaker<has_maker_and_toString> {
|
||||
static std::string convert( const has_maker_and_toString& ) {
|
||||
return "StringMaker<has_maker_and_toString>";
|
||||
struct StringMaker<has_maker_and_operator> {
|
||||
std::string operator()( const has_maker_and_operator& ) {
|
||||
return "StringMaker<has_maker_and_operator>";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Call the overload
|
||||
TEST_CASE( "toString( has_toString )", "[toString]" ) {
|
||||
has_toString item;
|
||||
REQUIRE( Catch::toString( item ) == "toString( has_toString )" );
|
||||
// Call the operator
|
||||
TEST_CASE( "stringify( has_operator )", "[toString]" ) {
|
||||
has_operator item;
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" );
|
||||
}
|
||||
|
||||
// Call the overload
|
||||
TEST_CASE( "toString( has_maker )", "toString]" ) {
|
||||
// Call the stringmaker
|
||||
TEST_CASE( "stringify( has_maker )", "[toString]" ) {
|
||||
has_maker item;
|
||||
REQUIRE( Catch::toString( item ) == "StringMaker<has_maker>" );
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" );
|
||||
}
|
||||
|
||||
// Call the overload
|
||||
TEST_CASE( "toString( has_maker_and_toString )", "[.][toString]" ) {
|
||||
has_maker_and_toString item;
|
||||
REQUIRE( Catch::toString( item ) == "toString( has_maker_and_toString )" );
|
||||
// Call the stringmaker
|
||||
TEST_CASE( "stringify( has_maker_and_toString )", "[.][toString]" ) {
|
||||
has_maker_and_operator item;
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" );
|
||||
}
|
||||
|
||||
// Vectors...
|
||||
|
||||
// Don't run this in approval tests as it is sensitive to two phase lookup differences
|
||||
TEST_CASE( "toString( vectors<has_toString )", "[.][toString][!nonportable]" ) {
|
||||
std::vector<has_toString> v(1);
|
||||
// This invokes template<T> toString which actually gives us '{ ? }'
|
||||
REQUIRE( Catch::toString( v ) == "{ {?} }" );
|
||||
std::vector<has_operator> v(1);
|
||||
REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString( vectors<has_maker )", "[toString]" ) {
|
||||
std::vector<has_maker> v(1);
|
||||
REQUIRE( Catch::toString( v ) == "{ StringMaker<has_maker> }" );
|
||||
REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" );
|
||||
}
|
||||
|
||||
|
||||
// Don't run this in approval tests as it is sensitive to two phase lookup differences
|
||||
TEST_CASE( "toString( vectors<has_maker_and_toString )", "[.][toString][!nonportable]" ) {
|
||||
std::vector<has_maker_and_toString> v(1);
|
||||
// Note: This invokes the template<T> toString -> StringMaker
|
||||
REQUIRE( Catch::toString( v ) == "{ StringMaker<has_maker_and_toString> }" );
|
||||
std::vector<has_maker_and_operator> v(1);
|
||||
REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_toString> }" );
|
||||
}
|
||||
|
@@ -14,15 +14,11 @@
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
template<>
|
||||
std::string toString<std::pair<int, int> >( const std::pair<int, int>& value )
|
||||
{
|
||||
namespace Catch {
|
||||
std::string toString( const std::pair<int, int>& value ) {
|
||||
std::ostringstream oss;
|
||||
oss << "std::pair( " << value.first << ", " << value.second << " )";
|
||||
return oss.str();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +336,7 @@ struct Awkward
|
||||
TEST_CASE( "non streamable - with conv. op", "[Tricky]" )
|
||||
{
|
||||
Awkward awkward;
|
||||
std::string s = Catch::toString( awkward );
|
||||
std::string s = ::Catch::Detail::stringify( awkward );
|
||||
REQUIRE( s == "7" );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user