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

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
diff options
context:
space:
mode:
authormelak472018-09-04 17:01:26 +0200
committerMartin Hořeňovský2018-09-10 11:37:26 +0200
commita575536abe20b58c48863600f8a71e93b4052b81 (patch)
tree5a602a98304fa10a3f63f4cbdb45b23591e528c1 /projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
parent1eb42eed974f944401091325bbe8e61b38fd0678 (diff)
downloadcatch3-a575536abe20b58c48863600f8a71e93b4052b81.tar.gz
Add StringMaker for std::(w)string_view
Fixes #1375
Diffstat (limited to 'projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp')
-rw-r--r--projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp b/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
index 3f6fa05f..acddf223 100644
--- a/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
+++ b/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
@@ -116,6 +116,18 @@ TEST_CASE("Static arrays are convertible to string", "[toString]") {
}
}
+#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
+
+TEST_CASE("String views are stringified like other strings", "[toString][approvals]") {
+ std::string_view view{"abc"};
+ CHECK(Catch::Detail::stringify(view) == R"("abc")");
+
+ std::string_view arr[] { view };
+ CHECK(Catch::Detail::stringify(arr) == R"({ "abc" })");
+}
+
+#endif
+
namespace {
struct WhatException : std::exception {