diff options
| author | Sean Middleditch | 2020-08-18 01:34:47 -0700 |
|---|---|---|
| committer | GitHub | 2020-08-18 10:34:47 +0200 |
| commit | 284672cc84f3fd53332618d1654d95bc4254ff3f (patch) | |
| tree | 1c704256b506269e8c27861e8281de424122d405 /projects/SelfTest/IntrospectiveTests/ToString.tests.cpp | |
| parent | 2b34b5c7d00ddd379ab62a8d37a7029f04223f45 (diff) | |
| download | catch3-284672cc84f3fd53332618d1654d95bc4254ff3f.tar.gz | |
Support sentinel-based ranges in default stringify (#2004)
Diffstat (limited to 'projects/SelfTest/IntrospectiveTests/ToString.tests.cpp')
| -rw-r--r-- | projects/SelfTest/IntrospectiveTests/ToString.tests.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/projects/SelfTest/IntrospectiveTests/ToString.tests.cpp b/projects/SelfTest/IntrospectiveTests/ToString.tests.cpp index caa924f5..d1eb261c 100644 --- a/projects/SelfTest/IntrospectiveTests/ToString.tests.cpp +++ b/projects/SelfTest/IntrospectiveTests/ToString.tests.cpp @@ -4,6 +4,13 @@ enum class EnumClass3 { Value1, Value2, Value3, Value4 }; +struct UsesSentinel { + using const_iterator = int const*; + using const_sentinel = std::nullptr_t; + + const_iterator begin() const { return nullptr; } + const_iterator end() const { return nullptr; } +}; TEST_CASE( "parseEnums", "[Strings][enums]" ) { using namespace Catch::Matchers; @@ -40,3 +47,7 @@ TEST_CASE( "Directly creating an EnumInfo" ) { CHECK( enumInfo->lookup(1) == "Value2" ); CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" ); } + +TEST_CASE("Range type with sentinel") { + CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" ); +}
\ No newline at end of file |