mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-03-08 18:41:19 +01:00
Improve comment parsing code coverage
This commit is contained in:
parent
efe4140208
commit
b8a273705e
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user