diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 3ca69cd79e33aa195f2dd5ea14f9d1d565bd0343..4205949ff98d26f381118087d6af60190310b50b 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -1715,16 +1715,20 @@ TEST(document_move_large)
 {
 	xml_document* doc = new xml_document();
 
+	xml_node dn = doc->append_child(STR("node"));
+
 	for (int i = 0; i < 3000; ++i)
-		doc->append_child(STR("node"));
+		dn.append_child(STR("child"));
 
 	xml_document other = std::move(*doc);
 	delete doc;
 
+	xml_node on = other.child(STR("node"));
+
 	for (int i = 0; i < 3000; ++i)
-		CHECK(other.remove_child(other.first_child()));
+		CHECK(on.remove_child(on.first_child()));
 
-	CHECK(!other.first_child());
+	CHECK(!on.first_child());
 }
 
 TEST_XML(document_move_buffer, "<node1/><node2/>")