summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-09-28 23:23:35 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-09-28 23:23:35 +0000
commitd519f7a473aa9cb9b4f5e81bd51b692d5f1c9220 (patch)
treecf3ce708959eaa54b05a0f55fe5df3e6f02c6b29 /tests
parentddf6db307868a4574e8d03090c94770b444d9abb (diff)
tests: Add a test for stackless copy
This test has previously caused a stack overflow on x86/MSVC. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1028 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests')
-rw-r--r--tests/test_dom_modify.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 0fb1911..6e17dd4 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -1242,3 +1242,25 @@ TEST_XML(dom_node_move_tree, "<root><n1 a1='v1'><c1/>t1</n1><n2 a2='v2'><c2/>t2<
CHECK(n3 == doc.child(STR("n3")));
CHECK(n4 == root.child(STR("n4")));
}
+
+TEST(dom_node_copy_stackless)
+{
+ unsigned int count = 20000;
+ std::basic_string<pugi::char_t> data;
+
+ for (unsigned int i = 0; i < count; ++i)
+ data += STR("<a>");
+
+ data += STR("text");
+
+ for (unsigned int i = 0; i < count; ++i)
+ data += STR("</a>");
+
+ xml_document doc;
+ CHECK(doc.load(data.c_str()));
+
+ xml_document copy;
+ CHECK(copy.append_copy(doc.first_child()));
+
+ CHECK_NODE(doc, data.c_str());
+}