diff --git a/tests/src/unit-delete_deprecated_functions.cpp b/tests/src/unit-delete_deprecated_functions.cpp index f54e9966a..a1d895370 100644 --- a/tests/src/unit-delete_deprecated_functions.cpp +++ b/tests/src/unit-delete_deprecated_functions.cpp @@ -22,6 +22,7 @@ using nlohmann::json; #include #include #include +#include #include #include #include @@ -109,6 +110,10 @@ JSON_TEST_DETECT(ptr_at, std::declval().at(std::declval::value); } +#endif + SECTION("the non-deprecated functions still work") { const json j = {{"a", {1, 2}}}; @@ -210,5 +217,13 @@ TEST_CASE("JSON_DELETE_DEPRECATED_FUNCTIONS") CHECK(j.at(ptr) == 2); CHECK(j.value(ptr, 0) == 2); CHECK(j.contains(ptr)); + + std::ostringstream os; + os << j; + CHECK(os.str() == R"({"a":[1,2]})"); + std::istringstream is(os.str()); + json parsed; + is >> parsed; + CHECK(parsed == j); } } diff --git a/tests/src/unit-element_access2.cpp b/tests/src/unit-element_access2.cpp index 9a7a58e6b..1b59d8add 100644 --- a/tests/src/unit-element_access2.cpp +++ b/tests/src/unit-element_access2.cpp @@ -1551,6 +1551,10 @@ TEST_CASE_TEMPLATE("element access 2", Json, nlohmann::json, nlohmann::ordered_j // count(0) used to compile and then crash instead of failing to compile using nlohmann::detail::is_detected; + // MSVC 2015 does not treat selecting a deleted function in decltype as + // a substitution failure, so it detects the deleted overloads as + // callable; calling them still fails to compile +#if !(defined(_MSC_VER) && _MSC_VER < 1910) CHECK_FALSE(is_detected::value); CHECK_FALSE(is_detected::value); CHECK_FALSE(is_detected::value); @@ -1562,6 +1566,7 @@ TEST_CASE_TEMPLATE("element access 2", Json, nlohmann::json, nlohmann::ordered_j // another integral literal type must be rejected as well, not just int CHECK_FALSE(is_detected::value); +#endif // the valid overloads must remain callable CHECK(is_detected::value);