Improve coverage of GenericPointer::Erase()

This commit is contained in:
miloyip 2015-05-21 16:45:39 +08:00
parent a2d09f0a03
commit 7ddaa80e46

View File

@ -875,7 +875,10 @@ TEST(Pointer, Erase) {
EXPECT_FALSE(Pointer("").Erase(d)); EXPECT_FALSE(Pointer("").Erase(d));
EXPECT_FALSE(Pointer("/nonexist").Erase(d)); EXPECT_FALSE(Pointer("/nonexist").Erase(d));
EXPECT_FALSE(Pointer("/foo/nonexist").Erase(d)); EXPECT_FALSE(Pointer("/foo/nonexist").Erase(d));
EXPECT_FALSE(Pointer("/foo/nonexist/nonexist").Erase(d));
EXPECT_FALSE(Pointer("/foo/0/nonexist").Erase(d)); EXPECT_FALSE(Pointer("/foo/0/nonexist").Erase(d));
EXPECT_FALSE(Pointer("/foo/0/nonexist/nonexist").Erase(d));
EXPECT_FALSE(Pointer("/foo/2/nonexist").Erase(d));
EXPECT_TRUE(Pointer("/foo/0").Erase(d)); EXPECT_TRUE(Pointer("/foo/0").Erase(d));
EXPECT_EQ(1u, d["foo"].Size()); EXPECT_EQ(1u, d["foo"].Size());
EXPECT_STREQ("baz", d["foo"][0].GetString()); EXPECT_STREQ("baz", d["foo"][0].GetString());