✅ add regression tests
This commit is contained in:
parent
666b0310f5
commit
3a4f5a8a9c
@ -181,6 +181,13 @@ class sax_no_exception : public nlohmann::detail::json_sax_dom_parser<json>
|
|||||||
|
|
||||||
std::string* sax_no_exception::error_string = nullptr;
|
std::string* sax_no_exception::error_string = nullptr;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// for #2982
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class my_allocator : public std::allocator<T>
|
||||||
|
{};
|
||||||
|
|
||||||
TEST_CASE("regression tests 2")
|
TEST_CASE("regression tests 2")
|
||||||
{
|
{
|
||||||
@ -679,6 +686,15 @@ TEST_CASE("regression tests 2")
|
|||||||
test3[json::json_pointer(p)] = json::object();
|
test3[json::json_pointer(p)] = json::object();
|
||||||
CHECK(test3.dump() == "{\"/root\":{}}");
|
CHECK(test3.dump() == "{\"/root\":{}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("issue #2982 - to_{binary format} does not provide a mechanism for specifying a custom allocator for the returned type")
|
||||||
|
{
|
||||||
|
std::vector<std::uint8_t, my_allocator<std::uint8_t>> my_vector;
|
||||||
|
json j = {1, 2, 3, 4};
|
||||||
|
json::to_cbor(j, my_vector);
|
||||||
|
json k = json::from_cbor(my_vector);
|
||||||
|
CHECK(j == k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DOCTEST_CLANG_SUPPRESS_WARNING_POP
|
DOCTEST_CLANG_SUPPRESS_WARNING_POP
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user