Fix CI: missing include and const-correctness

- Add #include <vector> to type_traits.hpp for the new
  is_compatible_binary_type trait's std::vector<std::uint8_t> reference
  (caught by cpplint's include-what-you-use check)
- Mark test-local json variables const where never reassigned
  (caught by clang-tidy's misc-const-correctness check)

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-07-10 22:31:03 +02:00
parent c37d96115d
commit a2be332fef
3 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -1140,7 +1140,7 @@ TEST_CASE("regression tests 2")
{
// Test that assigning a custom BinaryType directly creates a binary value, not an array
const std::vector<std::byte> original{std::byte{1}, std::byte{2}, std::byte{3}};
json_4804 j = original;
const json_4804 j = original;
CHECK(j.is_binary());
CHECK(!j.is_array());
@@ -1149,7 +1149,7 @@ TEST_CASE("regression tests 2")
CHECK(extracted == original);
// Test that the default json alias behavior is unchanged: std::vector<uint8_t> -> array
json default_json = std::vector<std::uint8_t> {1, 2, 3};
const json default_json = std::vector<std::uint8_t> {1, 2, 3};
CHECK(default_json.is_array());
CHECK(!default_json.is_binary());
}
@@ -1158,7 +1158,7 @@ TEST_CASE("regression tests 2")
{
// Test that extracting a custom BinaryType from a parsed JSON array still works
// (not just from a binary-typed node)
auto j = json_4804::parse("[1,2,3]");
const auto j = json_4804::parse("[1,2,3]");
CHECK(j.is_array());
CHECK(!j.is_binary());