summaryrefslogtreecommitdiff
path: root/tests/test_dom_modify.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-23 07:41:07 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-23 07:41:07 +0000
commit903db8682a5f14b52adec996584c70ea072619ea (patch)
treeb65c4c8bb68d7d0d77a204ca850c2d85bf7a5a6e /tests/test_dom_modify.cpp
parentbbd75fda4618dcbef272c8e5432153992c392588 (diff)
tests: Add more tests for better coverage
More tests for out-of-memory and other edge conditions git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_dom_modify.cpp')
-rw-r--r--tests/test_dom_modify.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 5f4e26c..01b562a 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -27,6 +27,16 @@ TEST_XML(dom_attr_assign, "<node/>")
CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"true\" />"));
}
+TEST_XML(dom_attr_set_name, "<node attr='value' />")
+{
+ xml_attribute attr = doc.child(STR("node")).attribute(STR("attr"));
+
+ CHECK(attr.set_name(STR("n")));
+ CHECK(!xml_attribute().set_name(STR("n")));
+
+ CHECK_NODE(doc, STR("<node n=\"value\" />"));
+}
+
TEST_XML(dom_attr_set_value, "<node/>")
{
xml_node node = doc.child(STR("node"));
@@ -758,8 +768,9 @@ TEST(dom_node_declaration_name)
doc.insert_child_after(node_declaration, doc.first_child());
doc.insert_child_before(node_declaration, doc.first_child());
+ doc.prepend_child(node_declaration);
- CHECK_NODE(doc, STR("<?xml?><?xml?><?xml?>"));
+ CHECK_NODE(doc, STR("<?xml?><?xml?><?xml?><?xml?>"));
}
TEST(dom_node_declaration_attributes)
@@ -867,17 +878,21 @@ TEST(dom_node_out_of_memory)
// verify all node modification operations
CHECK(!n.append_child());
+ CHECK(!n.prepend_child());
CHECK(!n.insert_child_after(node_element, n.first_child()));
CHECK(!n.insert_child_before(node_element, n.first_child()));
CHECK(!n.append_attribute(STR("")));
+ CHECK(!n.prepend_attribute(STR("")));
CHECK(!n.insert_attribute_after(STR(""), a));
CHECK(!n.insert_attribute_before(STR(""), a));
// verify node copy operations
CHECK(!n.append_copy(n.first_child()));
+ CHECK(!n.prepend_copy(n.first_child()));
CHECK(!n.insert_copy_after(n.first_child(), n.first_child()));
CHECK(!n.insert_copy_before(n.first_child(), n.first_child()));
CHECK(!n.append_copy(a));
+ CHECK(!n.prepend_copy(a));
CHECK(!n.insert_copy_after(a, a));
CHECK(!n.insert_copy_before(a, a));
}