Commit 41dd68f0 authored by Philipp A. Hartmann's avatar Philipp A. Hartmann

add simple test for unchanged DOM after parse error

parent fa123699
......@@ -95,6 +95,21 @@ TEST(Document, Parse) {
ParseTest<CrtAllocator, CrtAllocator>();
}
TEST(Document, UnchangedOnParseError) {
Document doc;
doc.SetArray().PushBack(0, doc.GetAllocator());
doc.Parse("{]");
EXPECT_TRUE(doc.HasParseError());
EXPECT_TRUE(doc.IsArray());
EXPECT_EQ(doc.Size(), 1u);
doc.Parse("{}");
EXPECT_FALSE(doc.HasParseError());
EXPECT_TRUE(doc.IsObject());
EXPECT_EQ(doc.MemberCount(), 0u);
}
static FILE* OpenEncodedFile(const char* filename) {
const char *paths[] = {
"encodings/%s",
......
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