Fix the clang-tidy findings in json_view's dump and its tests

- the SSE2 loop of the string scan is within NOLINTBEGIN/END
  (portability-simd-intrinsics), as in to_chars.hpp
- depth_counter<false>'s leave() and get() keep the interface of
  depth_counter<true> instead of being static
- write_ascii() compares the room left as a size_t variable
- the test's texts are a std::array, and a JSON fragment with escapes
  is a raw string literal

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-22 19:46:31 +02:00
1 parent 86049706a0
commit 2cf9df3eae
3 files changed
+19 -11

No files matched your search

+7 -5
View File
@@ -200,11 +200,13 @@ TEST_CASE("json_view dump")
{
std::string content(length, 'a');
content.insert(position, special);
const std::string texts[] =
const std::array<std::string, 3> texts =
{
"\"" + content + "\"",
"[\"" + content + "\"]",
"{\"" + content + "\":1}",
{
"\"" + content + "\"",
"[\"" + content + "\"]",
"{\"" + content + "\":1}",
}
};
for (const std::string& text : texts)
{
@@ -291,7 +293,7 @@ TEST_CASE("json_view dump")
std::string text;
for (int i = 0; i < depth; ++i)
{
text += i % 2 == 0 ? "[1," : "{\"k\":2,\"\\u00e9\":";
text += i % 2 == 0 ? "[1," : R"({"k":2,"\u00e9":)";
}
text += "[]";
for (int i = depth - 1; i >= 0; --i)