diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index 4060a5ab3639a190ce54338d0852bec6ee8ee802..4ec03f23d22460b4386e409538f94fe8a70eca47 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 374349931b3619e578631f1a2e7230d1b2d311ec..ff90f353cc6e6482501faf961106d8f73bcbcce5 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&);