From d519f7a473aa9cb9b4f5e81bd51b692d5f1c9220 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sun, 28 Sep 2014 23:23:35 +0000 Subject: 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 --- tests/test_dom_modify.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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, "t1t2< CHECK(n3 == doc.child(STR("n3"))); CHECK(n4 == root.child(STR("n4"))); } + +TEST(dom_node_copy_stackless) +{ + unsigned int count = 20000; + std::basic_string data; + + for (unsigned int i = 0; i < count; ++i) + data += STR(""); + + data += STR("text"); + + for (unsigned int i = 0; i < count; ++i) + data += STR(""); + + 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()); +} -- cgit v1.2.3