mirror of
https://github.com/nlohmann/json.git
synced 2026-07-13 14:05:08 +00:00
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:
@@ -13,6 +13,7 @@
|
|||||||
#include <tuple> // tuple
|
#include <tuple> // tuple
|
||||||
#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
|
#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
|
||||||
#include <utility> // declval
|
#include <utility> // declval
|
||||||
|
#include <vector> // vector
|
||||||
#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
|
#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
|
||||||
#include <cstddef> // byte
|
#include <cstddef> // byte
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3593,6 +3593,7 @@ NLOHMANN_JSON_NAMESPACE_END
|
|||||||
#include <tuple> // tuple
|
#include <tuple> // tuple
|
||||||
#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
|
#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
|
||||||
#include <utility> // declval
|
#include <utility> // declval
|
||||||
|
#include <vector> // vector
|
||||||
#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
|
#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
|
||||||
#include <cstddef> // byte
|
#include <cstddef> // byte
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1140,7 +1140,7 @@ TEST_CASE("regression tests 2")
|
|||||||
{
|
{
|
||||||
// Test that assigning a custom BinaryType directly creates a binary value, not an array
|
// 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}};
|
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_binary());
|
||||||
CHECK(!j.is_array());
|
CHECK(!j.is_array());
|
||||||
|
|
||||||
@@ -1149,7 +1149,7 @@ TEST_CASE("regression tests 2")
|
|||||||
CHECK(extracted == original);
|
CHECK(extracted == original);
|
||||||
|
|
||||||
// Test that the default json alias behavior is unchanged: std::vector<uint8_t> -> array
|
// 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_array());
|
||||||
CHECK(!default_json.is_binary());
|
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
|
// Test that extracting a custom BinaryType from a parsed JSON array still works
|
||||||
// (not just from a binary-typed node)
|
// (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_array());
|
||||||
CHECK(!j.is_binary());
|
CHECK(!j.is_binary());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user