Commit b8a27370 authored by Milo Yip's avatar Milo Yip

Improve comment parsing code coverage

parent efe41402
......@@ -1459,6 +1459,26 @@ TEST(Reader, IncompleteMultilineComment) {
EXPECT_EQ(kParseErrorUnspecificSyntaxError, reader.GetParseErrorCode());
}
TEST(Reader, IncompleteMultilineComment2) {
const char* json = "{\"hello\" : \"world\" /* *\0 */}";
StringStream s(json);
ParseObjectHandler h;
Reader reader;
EXPECT_FALSE(reader.Parse<kParseCommentsFlag>(s, h));
EXPECT_EQ(kParseErrorUnspecificSyntaxError, reader.GetParseErrorCode());
}
TEST(Reader, UnrecognizedComment) {
const char* json = "{\"hello\" : \"world\" /! }";
StringStream s(json);
ParseObjectHandler h;
Reader reader;
EXPECT_FALSE(reader.Parse<kParseCommentsFlag>(s, h));
EXPECT_EQ(kParseErrorUnspecificSyntaxError, reader.GetParseErrorCode());
}
#ifdef __GNUC__
RAPIDJSON_DIAG_POP
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment