From 67b103e5062b8fa443fd3a85d811d996bd39ae1d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 1 Nov 2026 20:42:58 +0100 Subject: [PATCH] Fix clang-tidy errors in json_view tests on develop (#5989) readability-math-missing-parentheses in unit-json_view_builder.cpp (#5974) and performance-inefficient-string-concatenation in unit-json_view_positions.cpp. Signed-off-by: Niels Lohmann --- tests/src/unit-json_view_builder.cpp | 2 +- tests/src/unit-json_view_positions.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/src/unit-json_view_builder.cpp b/tests/src/unit-json_view_builder.cpp index 06059aba8..988c25771 100644 --- a/tests/src/unit-json_view_builder.cpp +++ b/tests/src/unit-json_view_builder.cpp @@ -692,7 +692,7 @@ TEST_CASE("json_view builder: fraction digits") check_same(number); check_same("[" + number + "]"); std::string pair; - pair.reserve(number.size() * 2 + 3); + pair.reserve((number.size() * 2) + 3); pair += '['; pair += number; pair += ','; diff --git a/tests/src/unit-json_view_positions.cpp b/tests/src/unit-json_view_positions.cpp index c6afd7fcb..966c4b46a 100644 --- a/tests/src/unit-json_view_positions.cpp +++ b/tests/src/unit-json_view_positions.cpp @@ -521,7 +521,8 @@ TEST_CASE("json_view exceptions name the path and the bytes of the value") std::string text = "7"; for (int level = 0; level < 40; ++level) { - text = R"([[1, [2]], )" + text + R"(, {"k": [3, {"l": [4]}]}, [5, [6, [7]]]])"; + text.insert(0, R"([[1, [2]], )"); + text += R"(, {"k": [3, {"l": [4]}]}, [5, [6, [7]]]])"; } CAPTURE(text) const json j = json::parse(text);