summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_parse.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index efc3ca6..94e6f24 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -88,6 +88,16 @@ TEST(parse_pi_error)
CHECK(doc.load_string(STR("<?name& x?>"), parse_fragment | parse_pi).status == status_bad_pi);
}
+TEST(parse_pi_error_buffer_boundary)
+{
+ char buf1[] = "<?name?>";
+ char buf2[] = "<?name?x";
+
+ xml_document doc;
+ CHECK(doc.load_buffer_inplace(buf1, 8, parse_fragment | parse_pi));
+ CHECK(doc.load_buffer_inplace(buf2, 8, parse_fragment | parse_pi).status == status_bad_pi);
+}
+
TEST(parse_comments_skip)
{
xml_document doc;
@@ -1213,6 +1223,13 @@ TEST(parse_embed_pcdata)
}
}
+TEST_XML_FLAGS(parse_embed_pcdata_fragment, "text", parse_fragment | parse_embed_pcdata)
+{
+ CHECK_NODE(doc, STR("text"));
+ CHECK(doc.first_child().type() == node_pcdata);
+ CHECK_STRING(doc.first_child().value(), STR("text"));
+}
+
TEST(parse_encoding_detect)
{
char test[] = "<?xml version='1.0' encoding='utf-8'?><n/>";