summaryrefslogtreecommitdiff
path: root/tests/test_dom_modify.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-02 09:30:56 +0100
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-02 09:30:56 +0100
commite9948b4b05ca23cb95a6ca75ce4ee840e1fbda9b (patch)
tree798c9638505748dd1adc6313e56a0f80120c243a /tests/test_dom_modify.cpp
parentf68a320a0203279db2e8692cc9e21f71551454e4 (diff)
Fix undefined behavior while calling memcpy
Calling memcpy(x, 0, 0) is technically undefined (although it should usually be a no-op).
Diffstat (limited to 'tests/test_dom_modify.cpp')
-rw-r--r--tests/test_dom_modify.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 07fe6dc..45cf3ea 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -1091,6 +1091,19 @@ TEST_XML(dom_node_append_buffer_fragment, "<node />")
CHECK_NODE(doc, STR("<node>1234</node>"));
}
+TEST_XML(dom_node_append_buffer_empty, "<node />")
+{
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.append_buffer("", 0).status == status_no_document_element);
+ CHECK(node.append_buffer("", 0, parse_fragment).status == status_ok);
+
+ CHECK(node.append_buffer(0, 0).status == status_no_document_element);
+ CHECK(node.append_buffer(0, 0, parse_fragment).status == status_ok);
+
+ CHECK_NODE(doc, STR("<node />"));
+}
+
TEST_XML(dom_node_prepend_move, "<node>foo<child/></node>")
{
xml_node child = doc.child(STR("node")).child(STR("child"));