From 43494b862ef68cd4c675a19ada7a780ada200ceb Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 27 Sep 2026 06:20:42 +0200 Subject: [PATCH] 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 --- tests/src/unit-serialization.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/src/unit-serialization.cpp b/tests/src/unit-serialization.cpp index d9b10f45c..9999142ea 100644 --- a/tests/src/unit-serialization.cpp +++ b/tests/src/unit-serialization.cpp @@ -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);