summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-02 08:40:34 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-02-02 08:40:34 -0800
commitc28ff128d862ace16b7377dd943a8ca8f7bcfcb0 (patch)
tree7e8ff0f2ea6ea28dc4083ff7bf2d366530184b5e
parentf9f1c867166d9d07ebe2b370b7951d68c1f5c3ff (diff)
tests: Add more embed_pcdata tests
-rw-r--r--tests/test_parse.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index 94e6f24..013bca9 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -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/>";