mirror of
https://github.com/nlohmann/json.git
synced 2025-06-07 19:42:48 +08:00
# This is a combination of 2 commits.
# This is the 1st commit message: ✅ add test for #4440 Signed-off-by: Niels Lohmann <mail@nlohmann.me> # Conflicts: # tests/src/unit-regression2.cpp # This is the commit message #2: ✅ add test for #4440 Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
parent
4b17f90f65
commit
b4a5a4fbbc
@ -50,6 +50,11 @@ using ordered_json = nlohmann::ordered_json;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// for #4440
|
||||
#ifdef JSON_HAS_RANGES
|
||||
#include <ranges>
|
||||
#endif
|
||||
|
||||
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING("-Wexit-time-destructors")
|
||||
@ -1094,6 +1099,20 @@ TEST_CASE("regression tests 2")
|
||||
CHECK(j.type_name() == "invalid");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef JSON_HAS_RANGES
|
||||
SECTION("issue 4440")
|
||||
{
|
||||
auto noOpFilter = std::views::filter([](auto&&)
|
||||
{
|
||||
return true;
|
||||
});
|
||||
json j = {1, 2, 3};
|
||||
auto filtered = j | noOpFilter;
|
||||
CHECK(j == *filtered.begin());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_POP
|
||||
|
Loading…
Reference in New Issue
Block a user