mirror of
https://github.com/nlohmann/json.git
synced 2026-09-01 05:57:14 +00:00
Update the serializer test for the non-owning adapter ctor
check_escaped constructed the serializer with output_adapter<char>(ss), which produced the old owning output_adapter_t. The ctor now takes a non-owning output_adapter_protocol<char>*, so build the concrete output_stream_adapter on the stack and pass its address, matching how dump() and operator<< now call it. Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -98,7 +98,8 @@ void check_escaped(const char* original, const char* escaped = "", bool ensure_a
|
||||
void check_escaped(const char* original, const char* escaped, const bool ensure_ascii)
|
||||
{
|
||||
std::stringstream ss;
|
||||
json::serializer s(nlohmann::detail::output_adapter<char>(ss), ' ');
|
||||
nlohmann::detail::output_stream_adapter<char> adapter(ss);
|
||||
json::serializer s(&adapter, ' ');
|
||||
s.dump_escaped(original, ensure_ascii);
|
||||
s.flush(); // dump_escaped writes into the serializer's internal buffer
|
||||
CHECK(ss.str() == escaped);
|
||||
|
||||
Reference in New Issue
Block a user