Disrupt all C++17 tests to check if they are executed

This commit is contained in:
Alexander Karzhenkov 2020-12-19 17:23:58 +05:00
parent c3c574cf96
commit 8247a217bb
3 changed files with 6 additions and 0 deletions

View File

@ -465,6 +465,7 @@ TEST_CASE("value conversion")
#if defined(JSON_HAS_CPP_17) #if defined(JSON_HAS_CPP_17)
SECTION("std::string_view") SECTION("std::string_view")
{ {
static_assert(false);
std::string_view s = j.get<std::string_view>(); std::string_view s = j.get<std::string_view>();
CHECK(json(s) == j); CHECK(json(s) == j);
} }
@ -514,6 +515,7 @@ TEST_CASE("value conversion")
#if defined(JSON_HAS_CPP_17) #if defined(JSON_HAS_CPP_17)
SECTION("exception in case of a non-string type using string_view") SECTION("exception in case of a non-string type using string_view")
{ {
static_assert(false);
CHECK_THROWS_AS(json(json::value_t::null).get<std::string_view>(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::null).get<std::string_view>(), json::type_error&);
CHECK_THROWS_AS(json(json::value_t::object).get<std::string_view>(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::object).get<std::string_view>(), json::type_error&);
CHECK_THROWS_AS(json(json::value_t::array).get<std::string_view>(), json::type_error&); CHECK_THROWS_AS(json(json::value_t::array).get<std::string_view>(), json::type_error&);
@ -561,6 +563,7 @@ TEST_CASE("value conversion")
#if defined(JSON_HAS_CPP_17) #if defined(JSON_HAS_CPP_17)
SECTION("std::string_view") SECTION("std::string_view")
{ {
static_assert(false);
std::string s = "previous value"; std::string s = "previous value";
std::string_view sv = s; std::string_view sv = s;
j.get_to(sv); j.get_to(sv);
@ -617,6 +620,7 @@ TEST_CASE("value conversion")
#if defined(JSON_HAS_CPP_17) #if defined(JSON_HAS_CPP_17)
SECTION("std::string_view") SECTION("std::string_view")
{ {
static_assert(false);
std::string_view s = j.get<std::string_view>(); std::string_view s = j.get<std::string_view>();
CHECK(json(s) == j); CHECK(json(s) == j);
} }

View File

@ -886,6 +886,7 @@ TEST_CASE("items()")
#ifdef JSON_HAS_CPP_17 #ifdef JSON_HAS_CPP_17
SECTION("structured bindings") SECTION("structured bindings")
{ {
static_assert(false);
json j = { {"A", 1}, {"B", 2} }; json j = { {"A", 1}, {"B", 2} };
std::map<std::string, int> m; std::map<std::string, int> m;

View File

@ -250,6 +250,7 @@ TEST_CASE("regression tests 2")
#ifdef JSON_HAS_CPP_17 #ifdef JSON_HAS_CPP_17
SECTION("issue #1292 - Serializing std::variant causes stack overflow") SECTION("issue #1292 - Serializing std::variant causes stack overflow")
{ {
static_assert(false);
static_assert( static_assert(
!std::is_constructible<json, std::variant<int, float>>::value, ""); !std::is_constructible<json, std::variant<int, float>>::value, "");
} }