diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-23 05:46:44 +0000 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-23 05:46:44 +0000 |
commit | bbd75fda4618dcbef272c8e5432153992c392588 (patch) | |
tree | 8180298876db07ff3cfc553822c048fb372fc441 /tests/test_dom_modify.cpp | |
parent | 4a7762af9d96f8f12e8aa3f0c0899e9673d38d08 (diff) |
tests: Improve test coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1074 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_dom_modify.cpp')
-rw-r--r-- | tests/test_dom_modify.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index 612b017..5f4e26c 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -1354,3 +1354,38 @@ TEST_XML(dom_node_copy_out_of_memory, "<node><child1 attr1='value1' attr2='value for (int i = 0; i < 100; ++i) copy.append_copy(doc.first_child()); } + +TEST_XML(dom_node_remove_deallocate, "<node attr='value'>text</node>") +{ + xml_node node = doc.child(STR("node")); + + xml_attribute attr = node.attribute(STR("attr")); + attr.set_name(STR("longattr")); + attr.set_value(STR("longvalue")); + + node.set_name(STR("longnode")); + node.text().set(STR("longtext")); + + node.remove_attribute(attr); + doc.remove_child(node); + + CHECK_NODE(doc, STR("")); +} + +TEST_XML(dom_node_set_deallocate, "<node attr='value'>text</node>") +{ + xml_node node = doc.child(STR("node")); + + xml_attribute attr = node.attribute(STR("attr")); + + attr.set_name(STR("longattr")); + attr.set_value(STR("longvalue")); + node.set_name(STR("longnode")); + + attr.set_name(STR("")); + attr.set_value(STR("")); + node.set_name(STR("")); + node.text().set(STR("")); + + CHECK_NODE(doc, STR("<:anonymous :anonymous=\"\"></:anonymous>")); +} |