Remove testing of CATCH_CONFIG_FALLBACK_STRINGIFIER from SelfTest

This removes a potential ODR violation and the configuration option
is tested in its own separate binary anyway.
This commit is contained in:
Martin Hořeňovský 2020-01-21 15:14:24 +01:00
parent 2b696c4388
commit d63681f707
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
4 changed files with 12 additions and 22 deletions

View File

@ -1692,14 +1692,14 @@ ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(string
== ==
"stringmaker(streamable_range)" "stringmaker(streamable_range)"
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" for: "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" for: "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }"
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" for: "{ !!! }" == "{ !!! }" ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(disabled_range{}) == "{?}" for: "{?}" == "{?}"
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" for: "StringMaker<has_maker>" ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" for: "StringMaker<has_maker>"
== ==
"StringMaker<has_maker>" "StringMaker<has_maker>"
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" for: "StringMaker<has_maker_and_operator>" ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" for: "StringMaker<has_maker_and_operator>"
== ==
"StringMaker<has_maker_and_operator>" "StringMaker<has_maker_and_operator>"
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(item) == "{ !!! }" for: "{ !!! }" == "{ !!! }" ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(item) == "{?}" for: "{?}" == "{?}"
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )" ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )"
== ==
"operator<<( has_operator )" "operator<<( has_operator )"

View File

@ -12545,9 +12545,9 @@ with expansion:
"{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }"
ToStringWhich.tests.cpp:<line number>: PASSED: ToStringWhich.tests.cpp:<line number>: PASSED:
REQUIRE( ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" ) REQUIRE( ::Catch::Detail::stringify(disabled_range{}) == "{?}" )
with expansion: with expansion:
"{ !!! }" == "{ !!! }" "{?}" == "{?}"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
stringify( has_maker ) stringify( has_maker )
@ -12582,9 +12582,9 @@ ToStringWhich.tests.cpp:<line number>
............................................................................... ...............................................................................
ToStringWhich.tests.cpp:<line number>: PASSED: ToStringWhich.tests.cpp:<line number>: PASSED:
REQUIRE( ::Catch::Detail::stringify(item) == "{ !!! }" ) REQUIRE( ::Catch::Detail::stringify(item) == "{?}" )
with expansion: with expansion:
"{ !!! }" == "{ !!! }" "{?}" == "{?}"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
stringify( has_operator ) stringify( has_operator )

View File

@ -15098,10 +15098,10 @@ loose text artifact
</Expression> </Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Original> <Original>
::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" ::Catch::Detail::stringify(disabled_range{}) == "{?}"
</Original> </Original>
<Expanded> <Expanded>
"{ !!! }" == "{ !!! }" "{?}" == "{?}"
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
@ -15135,10 +15135,10 @@ loose text artifact
<TestCase name="stringify( has_neither )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <TestCase name="stringify( has_neither )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Original> <Original>
::Catch::Detail::stringify(item) == "{ !!! }" ::Catch::Detail::stringify(item) == "{?}"
</Original> </Original>
<Expanded> <Expanded>
"{ !!! }" == "{ !!! }" "{?}" == "{?}"
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>

View File

@ -3,16 +3,6 @@
* for various types * for various types
*/ */
// Replace fallback stringifier for this TU
// We should avoid ODR violations because these specific types aren't
// present in different TUs
#include <string>
template <typename T>
std::string fallbackStringifier(T const&) {
return "{ !!! }";
}
#define CATCH_CONFIG_FALLBACK_STRINGIFIER fallbackStringifier
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
@ -85,7 +75,7 @@ TEST_CASE( "stringify( has_maker_and_operator )", "[toString]" ) {
TEST_CASE("stringify( has_neither )", "[toString]") { TEST_CASE("stringify( has_neither )", "[toString]") {
has_neither item; has_neither item;
REQUIRE( ::Catch::Detail::stringify(item) == "{ !!! }" ); REQUIRE( ::Catch::Detail::stringify(item) == "{?}" );
} }
// Call the templated operator // Call the templated operator
@ -189,5 +179,5 @@ TEST_CASE("stringify ranges", "[toString]") {
REQUIRE(::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)"); REQUIRE(::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)");
REQUIRE(::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)"); REQUIRE(::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)");
REQUIRE(::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }"); REQUIRE(::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }");
REQUIRE(::Catch::Detail::stringify(disabled_range{}) == "{ !!! }"); REQUIRE(::Catch::Detail::stringify(disabled_range{}) == "{?}");
} }