Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
diff options
context:
space:
mode:
authorSean Middleditch2020-08-18 01:34:47 -0700
committerMartin Hořeňovský2020-09-07 14:23:47 +0200
commit31d483124532184aefc9595903af7493c206b874 (patch)
treea8acde3177a120accb08b1953d721a9d4b1dd5a4 /tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
parent08fb5cbab2f8cf59c6960da9d7b54e5841bfd097 (diff)
downloadcatch3-31d483124532184aefc9595903af7493c206b874.tar.gz
Support sentinel-based ranges in default stringify (#2004)
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/ToString.tests.cpp')
-rw-r--r--tests/SelfTest/IntrospectiveTests/ToString.tests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp b/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
index b50a4012..47dfdd37 100644
--- a/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
+++ b/tests/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