0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-14 01:47:55 +08:00

tests: Add more embed_pcdata tests

This commit is contained in:
Arseny Kapoulkine 2017-02-02 08:40:34 -08:00
parent f9f1c86716
commit c28ff128d8

View File

@ -1230,6 +1230,26 @@ TEST_XML_FLAGS(parse_embed_pcdata_fragment, "text", parse_fragment | parse_embed
CHECK_STRING(doc.first_child().value(), STR("text"));
}
TEST_XML_FLAGS(parse_embed_pcdata_child, "<n><child/>text</n>", parse_embed_pcdata)
{
xml_node n = doc.child(STR("n"));
CHECK_NODE(doc, STR("<n><child/>text</n>"));
CHECK(n.last_child().type() == node_pcdata);
CHECK_STRING(n.last_child().value(), STR("text"));
}
TEST_XML_FLAGS(parse_embed_pcdata_comment, "<n>text1<!---->text2</n>", parse_embed_pcdata)
{
xml_node n = doc.child(STR("n"));
CHECK_NODE(doc, STR("<n>text1text2</n>"));
CHECK_STRING(n.value(), STR("text1"));
CHECK(n.first_child() == n.last_child());
CHECK(n.last_child().type() == node_pcdata);
CHECK_STRING(n.last_child().value(), STR("text2"));
}
TEST(parse_encoding_detect)
{
char test[] = "<?xml version='1.0' encoding='utf-8'?><n/>";