mirror of
https://github.com/nlohmann/json.git
synced 2026-11-03 11:25:33 +00:00
* json_view: get<T>() of a boolean throws for number_integer_t, number_unsigned_t and number_float_t like basic_json (#5988) basic_json::get<T>() of a boolean throws type_error.302 for exactly number_integer_t, number_unsigned_t and number_float_t (dedicated from_json() overloads) and gives 0/1 for every other arithmetic type. The view returned 0/1 for all of them, contradicting its documentation. The view now throws the same exception (same message, with path/bytes decoration) for these three types. basic_json is unchanged; its behavior is documented and pinned by a test. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * tests: skip throwing json_view bool get<T>() combinations without exceptions (#5988) check_boolean_get_parity() called get<T>() for number_integer_t, number_unsigned_t and number_float_t in its JSON_NOEXCEPTION branch, but a boolean throws type_error.302 for exactly these types, so JSON_THROW aborted test-json_view_cpp11/cpp17 in ci_test_noexceptions. Skip these combinations there; the throwing checks stay in the exceptions-enabled build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5NasAgbDGG28MqXjQvLqp Signed-off-by: Claude <noreply@anthropic.com> * Expect the byte range of the root in the json_view boolean get<T>() test With JSON_DIAGNOSTIC_POSITIONS, the type_error.302 message starts with "(bytes 0-4)"; build the expected text with json_view_test::message(), as the other tests of the root value do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5NasAgbDGG28MqXjQvLqp Signed-off-by: Claude <noreply@anthropic.com> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> Signed-off-by: Claude <noreply@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>