diff --git a/cmake/test.cmake b/cmake/test.cmake index 1e9f49001..adb3530d6 100644 --- a/cmake/test.cmake +++ b/cmake/test.cmake @@ -416,9 +416,11 @@ function(json_test_add_unity_tests) endforeach() # files that must not be merged into a batch: unit-32bit.cpp is only built - # for 32bit targets, and unit-no-macro-leak.cpp checks that including the - # library defines no unprefixed macro, which any other file would disturb - set(standalone_files unit-32bit.cpp unit-no-macro-leak.cpp) + # for 32bit targets, unit-no-macro-leak.cpp checks that including the + # library defines no unprefixed macro, which any other file would disturb, + # and unit-noexcept.cpp suppresses GCC's -Wnoexcept around its include of + # the library, which has no effect once another file included it first + set(standalone_files unit-32bit.cpp unit-no-macro-leak.cpp unit-noexcept.cpp) set(harmless_macros "^(DOCTEST_.*|SKIP_TESTS_FOR_.*|JSON_TEST_DEPRECATED_FUNCTIONS_DELETED|JSON_TEST_STRICT_NUL_HANDLING_ENABLED|JSON_TEST_STRINGIZE)$") diff --git a/tests/src/unit-comparison.cpp b/tests/src/unit-comparison.cpp index c9e600c32..8048f9fe7 100644 --- a/tests/src/unit-comparison.cpp +++ b/tests/src/unit-comparison.cpp @@ -595,7 +595,7 @@ struct unordered_object_t : std::map, Allocator> using unordered_json = nlohmann::json::with_object_t; // the entries "0" to "9", enumerated in ascending or in descending order -unordered_json make_unordered_object(const bool descending) +inline unordered_json make_unordered_object(const bool descending) { unordered_json j = unordered_json::object_t(directed_less(descending)); for (int i = 0; i < 10; ++i) @@ -676,7 +676,15 @@ using case_insensitive_map = std::map; } // namespace unit_comparison_detail -using namespace unit_comparison_detail; // NOLINT(google-build-using-namespace) +// using-declarations rather than a using-directive, as this file may be +// #include-d into a batch with other test files (JSON_TestUnityBuild) +using unit_comparison_detail::ci_json; +using unit_comparison_detail::innermost; +using unit_comparison_detail::key_case_json; +using unit_comparison_detail::key_case_less; +using unit_comparison_detail::make_unordered_object; +using unit_comparison_detail::nest; +using unit_comparison_detail::unordered_json; TEST_CASE("equality of objects whose entries have no fixed order") { diff --git a/tests/src/unit-json_pointer-cpp20.cpp b/tests/src/unit-json_pointer-cpp20.cpp index 75d5f8c76..c40a5e735 100644 --- a/tests/src/unit-json_pointer-cpp20.cpp +++ b/tests/src/unit-json_pointer-cpp20.cpp @@ -28,7 +28,9 @@ using nlohmann::json; #endif #ifdef JSON_HAS_CPP_20 -#include +#if JSON_HAS_THREE_WAY_COMPARISON + #include +#endif #include #include