mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 03:30:31 +00:00
* Match ABI tag order in namespace tests to abi_macros.hpp NLOHMANN_JSON_ABI_TAGS concatenates the tags as _diag, _ldvcmp, _dp, but the default and noversion ABI tests expected _diag, _dp, _ldvcmp. The tests therefore failed whenever both JSON_DIAGNOSTIC_POSITIONS and JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON were enabled, a combination CI never exercises. Reorder the expectations to match the header. Also document the _dp tag in the namespace feature page, which listed only _diag and _ldvcmp. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Test the ABI namespace with all ABI tags enabled Build the default and noversion ABI config tests a second time with JSON_DIAGNOSTICS, JSON_DIAGNOSTIC_POSITIONS and JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON all set, so the expected tag order is checked on every test run instead of depending on which CMake options a CI job happens to enable. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
37 lines
1.4 KiB
CMake
37 lines
1.4 KiB
CMake
# test the different options to change the namespace
|
|
|
|
# test default namespace
|
|
add_executable(abi_config_default default.cpp)
|
|
target_link_libraries(abi_config_default PRIVATE abi_compat_main)
|
|
add_test(
|
|
NAME test-abi_config_default
|
|
COMMAND abi_config_default ${DOCTEST_TEST_FILTER})
|
|
|
|
# test no version namespace
|
|
add_executable(abi_config_noversion noversion.cpp)
|
|
target_link_libraries(abi_config_noversion PRIVATE abi_compat_main)
|
|
add_test(
|
|
NAME test-abi_config_noversion
|
|
COMMAND abi_config_noversion ${DOCTEST_TEST_FILTER})
|
|
|
|
# test default and no version namespace with all ABI tags enabled, so the
|
|
# expected tag order is checked regardless of the JSON_* CMake options
|
|
foreach(test default noversion)
|
|
add_executable(abi_config_${test}_all_tags ${test}.cpp)
|
|
target_compile_definitions(abi_config_${test}_all_tags PRIVATE
|
|
JSON_DIAGNOSTICS=1
|
|
JSON_DIAGNOSTIC_POSITIONS=1
|
|
JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1)
|
|
target_link_libraries(abi_config_${test}_all_tags PRIVATE abi_compat_main)
|
|
add_test(
|
|
NAME test-abi_config_${test}_all_tags
|
|
COMMAND abi_config_${test}_all_tags ${DOCTEST_TEST_FILTER})
|
|
endforeach()
|
|
|
|
# test custom namespace
|
|
add_executable(abi_config_custom custom.cpp)
|
|
target_link_libraries(abi_config_custom PRIVATE abi_compat_main)
|
|
add_test(
|
|
NAME test-abi_config_custom
|
|
COMMAND abi_config_custom ${DOCTEST_TEST_FILTER})
|