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());
|
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__
|
#ifdef __GNUC__
|
||||||
RAPIDJSON_DIAG_POP
|
RAPIDJSON_DIAG_POP
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user