Fix the tests for disabled implicit conversions and strict NUL handling

- unit-iterators1 (#5835) converted a json element to int implicitly,
  which does not compile with JSON_USE_IMPLICIT_CONVERSIONS=0.
- unit-testsuites parses a number followed by a NUL byte, which
  JSON_STRICT_NUL_HANDLING rejects; leave the NUL out in strict mode.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-16 09:05:09 +02:00
1 parent e5b8f453e5
commit a249c51b55
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -1661,7 +1661,7 @@ TEST_CASE_TEMPLATE("reverse iteration and member access", Json, nlohmann::json,
seen.clear();
for (auto r = j.crbegin(); r != j.crend(); ++r)
{
seen.push_back(*r);
seen.push_back(r->template get<int>());
}
CHECK(seen == std::vector<int> {4, 3, 2, 1});
}
+4
View File
@@ -218,7 +218,11 @@ TEST_CASE("compliance tests from nativejson-benchmark")
n1e308[0] = '[';
n1e308[1] = '1';
n1e308[310] = ']';
#if JSON_STRICT_NUL_HANDLING
n1e308.resize(311); // a NUL byte after the value is a syntax error in strict mode
#else
n1e308[311] = '\0';
#endif
TEST_DOUBLE(n1e308, 1E308);
}