summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-10-20 21:53:42 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-10-20 21:53:42 -0700
commitb0fc587a7fbeb902bb0760dba73ee621105a86bc (patch)
tree060d40c3fb2df74faeb6d68d1c287e74506bdc02 /tests
parent50bc0d5a69afcbad0df8de8f831f6ee58504aa6d (diff)
tests: Add more move tests
We now check that appending a child to a moved document performs no allocations - this is already the case, but if we neglected to copy the allocator state this test would fail.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_document.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 4205949..e6b9081 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -1739,4 +1739,15 @@ TEST_XML(document_move_buffer, "<node1/><node2/>")
CHECK(other.child(STR("node2")).offset_debug() == 9);
}
+
+TEST_XML(document_move_append_child_zero_alloc, "<node1/><node2/>")
+{
+ test_runner::_memory_fail_threshold = 1;
+
+ xml_document other = std::move(doc);
+
+ CHECK(other.append_child(STR("node3")));
+
+ CHECK_NODE(other, STR("<node1/><node2/><node3/>"));
+}
#endif