Write test case for parse error when unpacking unused 0xc1

This commit is contained in:
Huu Nguyen 2015-10-18 12:04:37 -04:00
parent 6bf5160bf2
commit 282b0b5927

View File

@ -372,3 +372,22 @@ TEST(unpack, insufficient_bytes_zone)
EXPECT_EQ(off, 0u); EXPECT_EQ(off, 0u);
} }
} }
TEST(unpack, parse_error)
{
msgpack::sbuffer sbuf;
char c = '\xc1';
sbuf.write(&c, 1);
bool thrown = false;
msgpack::unpacked msg;
try {
msgpack::unpack(msg, sbuf.data(), sbuf.size());
EXPECT_TRUE(false);
}
catch (msgpack::parse_error const&) {
thrown = true;
}
EXPECT_TRUE(thrown);
}