mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-14 02:56:35 +02:00
serializeXxx()
sets std::string
and String
instead of appending
This commit is contained in:
@ -12,14 +12,14 @@ TEST_CASE("serialize JsonArray to std::string") {
|
||||
array.add(2);
|
||||
|
||||
SECTION("serializeJson()") {
|
||||
std::string json;
|
||||
std::string json = "erase me";
|
||||
serializeJson(array, json);
|
||||
|
||||
REQUIRE("[4,2]" == json);
|
||||
}
|
||||
|
||||
SECTION("serializeJsonPretty") {
|
||||
std::string json;
|
||||
std::string json = "erase me";
|
||||
serializeJsonPretty(array, json);
|
||||
|
||||
REQUIRE("[\r\n 4,\r\n 2\r\n]" == json);
|
||||
@ -32,14 +32,14 @@ TEST_CASE("serialize JsonObject to std::string") {
|
||||
obj["key"] = "value";
|
||||
|
||||
SECTION("object") {
|
||||
std::string json;
|
||||
std::string json = "erase me";
|
||||
serializeJson(doc, json);
|
||||
|
||||
REQUIRE("{\"key\":\"value\"}" == json);
|
||||
}
|
||||
|
||||
SECTION("serializeJsonPretty") {
|
||||
std::string json;
|
||||
std::string json = "erase me";
|
||||
serializeJsonPretty(doc, json);
|
||||
|
||||
REQUIRE("{\r\n \"key\": \"value\"\r\n}" == json);
|
||||
@ -50,7 +50,7 @@ TEST_CASE("serialize an std::string containing a NUL") {
|
||||
JsonDocument doc;
|
||||
doc.set(std::string("hello\0world", 11));
|
||||
|
||||
std::string json;
|
||||
std::string json = "erase me";
|
||||
serializeJson(doc, json);
|
||||
CHECK("\"hello\\u0000world\"" == json);
|
||||
}
|
||||
|
Reference in New Issue
Block a user