mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Support sentinel-based ranges in default stringify (#2004)
This commit is contained in:

committed by
Martin Hořeňovský

parent
08fb5cbab2
commit
31d4831245
@@ -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{}) == "{ }" );
|
||||
}
|
Reference in New Issue
Block a user