mirror of
https://github.com/nlohmann/json.git
synced 2026-09-29 11:10:30 +00:00
Build the expected dump of the nested-object test with +=
clang-tidy (performance-inefficient-string-concatenation) reported the chain of operator+ calls that assembled the expected indented output. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -726,8 +726,18 @@ TEST_CASE("serialization of every kind of value below the bound of the descent")
|
||||
|
||||
const std::string indent(2 * i, ' ');
|
||||
const std::string outer_indent(2 * (i - 1), ' ');
|
||||
expected = "{\n" + indent + "\"k\": " + expected + ",\n"
|
||||
+ indent + "\"n\": " + std::to_string(i) + "\n" + outer_indent + "}";
|
||||
std::string next = "{\n";
|
||||
next += indent;
|
||||
next += "\"k\": ";
|
||||
next += expected;
|
||||
next += ",\n";
|
||||
next += indent;
|
||||
next += "\"n\": ";
|
||||
next += std::to_string(i);
|
||||
next += '\n';
|
||||
next += outer_indent;
|
||||
next += '}';
|
||||
expected = std::move(next);
|
||||
}
|
||||
|
||||
CHECK(j.dump(2) == expected);
|
||||
|
||||
Reference in New Issue
Block a user