diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index 4060a5ab..4ec03f23 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -1224,6 +1224,13 @@ TEST_CASE("CBOR") SECTION("errors") { + SECTION("empty byte vector") + { + CHECK_THROWS_AS(json::from_cbor(std::vector()), json::parse_error&); + CHECK_THROWS_WITH(json::from_cbor(std::vector()), + "[json.exception.parse_error.110] parse error at 1: unexpected end of input"); + } + SECTION("too short byte vector") { CHECK_THROWS_AS(json::from_cbor(std::vector({0x18})), json::parse_error&); diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp index 37434993..ff90f353 100644 --- a/test/src/unit-msgpack.cpp +++ b/test/src/unit-msgpack.cpp @@ -1014,6 +1014,13 @@ TEST_CASE("MessagePack") SECTION("errors") { + SECTION("empty byte vector") + { + CHECK_THROWS_AS(json::from_msgpack(std::vector()), json::parse_error&); + CHECK_THROWS_WITH(json::from_msgpack(std::vector()), + "[json.exception.parse_error.110] parse error at 1: unexpected end of input"); + } + SECTION("too short byte vector") { CHECK_THROWS_AS(json::from_msgpack(std::vector({0xcc})), json::parse_error&);