diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index d67f5acb..0b4bd912 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -39,6 +39,10 @@ using nlohmann::json; #include #include +#if defined(JSON_HAS_CPP_17) +#include +#endif + TEST_CASE("value conversion") { SECTION("get an object (explicit)") @@ -292,6 +296,13 @@ TEST_CASE("value conversion") std::string s = j.get(); CHECK(json(s) == j); } +#if defined(JSON_HAS_CPP_17) + SECTION("std::string_view") + { + std::string_view s = j.get(); + CHECK(json(s) == j); + } +#endif SECTION("exception in case of a non-string type") { @@ -331,6 +342,14 @@ TEST_CASE("value conversion") CHECK(json(s) == j); } +#if defined(JSON_HAS_CPP_17) + SECTION("std::string_view") + { + std::string_view s = j; + CHECK(json(s) == j); + } +#endif + SECTION("std::string") { std::string s = j;