summaryrefslogtreecommitdiff
path: root/tests/test_dom_modify.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-25 16:37:16 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-25 16:37:16 +0000
commit0b7964917cbfd9d007c8a017eaced636f53ddeb3 (patch)
tree557a2abed7a5079afe56e40cab15a46b6c468a94 /tests/test_dom_modify.cpp
parent503abf607a9e1d5d778edb48e00514f5cb73f777 (diff)
Fix node copying for some out of memory cases
A page can fail to allocate during attribute creation; this case was not previously handled. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1080 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_dom_modify.cpp')
-rw-r--r--tests/test_dom_modify.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 01b562a..07fe6dc 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -1361,13 +1361,22 @@ TEST_XML(dom_node_copyless_taint, "<node attr=\"value\" />")
CHECK_NODE(doc, STR("<nod1 attr=\"value\" /><node attr=\"valu2\" /><node att3=\"value\" />"));
}
-TEST_XML(dom_node_copy_out_of_memory, "<node><child1 attr1='value1' attr2='value2' /><child2 /><child3>text1<child4 />text2</child3></node>")
+TEST_XML(dom_node_copy_out_of_memory_node, "<node><child1 /><child2 /><child3>text1<child4 />text2</child3></node>")
{
test_runner::_memory_fail_threshold = 32768 * 2 + 4096;
- xml_document copy;
- for (int i = 0; i < 100; ++i)
- copy.append_copy(doc.first_child());
+ xml_document copy;
+ for (int i = 0; i < 1000; ++i)
+ copy.append_copy(doc.first_child());
+}
+
+TEST_XML(dom_node_copy_out_of_memory_attr, "<node attr1='' attr2='' attr3='' attr4='' attr5='' attr6='' attr7='' attr8='' attr9='' attr10='' attr11='' attr12='' attr13='' attr14='' attr15='' />")
+{
+ test_runner::_memory_fail_threshold = 32768 * 2 + 4096;
+
+ xml_document copy;
+ for (int i = 0; i < 1000; ++i)
+ copy.append_copy(doc.first_child());
}
TEST_XML(dom_node_remove_deallocate, "<node attr='value'>text</node>")