Support sentinel-based ranges in default stringify (#2004)

This commit is contained in:
Sean Middleditch
2020-08-18 01:34:47 -07:00
committed by Martin Hořeňovský
parent 08fb5cbab2
commit 31d4831245
11 changed files with 53 additions and 12 deletions

View File

@@ -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{}) == "{ }" );
}