From ecce914701bde4889f05245605a54e9f42af10c1 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 29 Sep 2026 02:34:54 +0200 Subject: [PATCH] Mark the cases of the view's serializer that tests cannot reach Signed-off-by: Niels Lohmann --- include/nlohmann/detail/view/serializer.hpp | 14 +++++++------- single_include/nlohmann/json_view.hpp | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/nlohmann/detail/view/serializer.hpp b/include/nlohmann/detail/view/serializer.hpp index 38377e9c0..98c7335dd 100644 --- a/include/nlohmann/detail/view/serializer.hpp +++ b/include/nlohmann/detail/view/serializer.hpp @@ -259,12 +259,12 @@ class view_serializer write_float(float_value(m_doc.str(n), n)); } break; - case value_t::object: - case value_t::array: - case value_t::binary: - case value_t::discarded: - default: - break; + case value_t::object: // LCOV_EXCL_LINE (containers are written by dump()) + case value_t::array: // LCOV_EXCL_LINE + case value_t::binary: // LCOV_EXCL_LINE (not in a document) + case value_t::discarded: // LCOV_EXCL_LINE + default: // LCOV_EXCL_LINE + break; // LCOV_EXCL_LINE } } @@ -399,7 +399,7 @@ class view_serializer } return; } - m_out.put(reinterpret_cast(bytes), len); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) + m_out.put(reinterpret_cast(bytes), len); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) LCOV_EXCL_LINE (printable characters are copied in runs) } void write_u_escape(std::uint32_t u) diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index f7b68df76..bc0ca03b9 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -2825,12 +2825,12 @@ class view_serializer write_float(float_value(m_doc.str(n), n)); } break; - case value_t::object: - case value_t::array: - case value_t::binary: - case value_t::discarded: - default: - break; + case value_t::object: // LCOV_EXCL_LINE (containers are written by dump()) + case value_t::array: // LCOV_EXCL_LINE + case value_t::binary: // LCOV_EXCL_LINE (not in a document) + case value_t::discarded: // LCOV_EXCL_LINE + default: // LCOV_EXCL_LINE + break; // LCOV_EXCL_LINE } } @@ -2965,7 +2965,7 @@ class view_serializer } return; } - m_out.put(reinterpret_cast(bytes), len); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) + m_out.put(reinterpret_cast(bytes), len); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) LCOV_EXCL_LINE (printable characters are copied in runs) } void write_u_escape(std::uint32_t u)