mirror of
https://github.com/nlohmann/json.git
synced 2026-09-06 16:27:59 +00:00
tests/src/unit-class_parser_diagnostic_positions.cpp and tests/src/unit-diagnostic-positions-only.cpp were maintained as near-copies of unit-class_parser.cpp and unit-diagnostic-positions.cpp respectively, and had drifted: trailing-comma handling, the #5342 filter-array/filter-value sections, and the cross-input-adapter diagnostics test were never ported to the positions-enabled copy. Fold the position-specific assertions into the base files, guarded by #if JSON_DIAGNOSTIC_POSITIONS / #if JSON_DIAGNOSTICS, and compile each base file a second time with the relevant macro set via CMake COMPILE_DEFINITIONS (mirroring the existing test-comparison_legacy pattern) instead of maintaining a separate source file. This removes the duplication and, as a side effect, closes the coverage gaps above since the full test file now compiles under JSON_DIAGNOSTIC_POSITIONS=1 as well. Fixes #5417 Signed-off-by: Niels Lohmann <mail@nlohmann.me>