Skip to content

Commit

Permalink
Merge pull request google#340 from google/v0.10.2
Browse files Browse the repository at this point in the history
Merge test from v0.10.2 to master.
  • Loading branch information
nostrademons committed Jun 10, 2015
2 parents 3973c58 + 4fc537b commit ee9e256
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1954,4 +1954,25 @@ TEST_F(GumboParserTest, FragmentWithNamespace) {
EXPECT_EQ(0, GetChildCount(div));
}

TEST_F(GumboParserTest, FragmentWithTwoNodes) {
ParseFragment("<h1>Hi</h1><br>", GUMBO_TAG_BODY, GUMBO_NAMESPACE_HTML);

EXPECT_EQ(1, GetChildCount(root_));

GumboNode* html = GetChild(root_, 0);
ASSERT_EQ(GUMBO_NODE_ELEMENT, html->type);
EXPECT_EQ(GUMBO_TAG_HTML, html->v.element.tag);
EXPECT_EQ(2, GetChildCount(html));

GumboNode* h1 = GetChild(html, 0);
ASSERT_EQ(GUMBO_NODE_ELEMENT, h1->type);
EXPECT_EQ(GUMBO_TAG_H1, h1->v.element.tag);
EXPECT_EQ(1, GetChildCount(h1));

GumboNode* br = GetChild(html, 1);
ASSERT_EQ(GUMBO_NODE_ELEMENT, br->type);
EXPECT_EQ(GUMBO_TAG_BR, br->v.element.tag);
EXPECT_EQ(0, GetChildCount(br));
}

} // namespace

0 comments on commit ee9e256

Please sign in to comment.