summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r--tests/test_document.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index f9fcc97..342d07c 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -876,3 +876,33 @@ TEST_XML_FLAGS(document_element_absent, "<!---->", parse_comments)
{
CHECK(doc.document_element() == xml_node());
}
+
+TEST_XML(document_reset, "<node><child/></node>")
+{
+ CHECK(doc.first_child());
+
+ doc.reset();
+ CHECK(!doc.first_child());
+ CHECK_NODE(doc, STR(""));
+
+ doc.reset();
+ CHECK(!doc.first_child());
+ CHECK_NODE(doc, STR(""));
+
+ CHECK(doc.load(STR("<node/>")));
+ CHECK(doc.first_child());
+ CHECK_NODE(doc, STR("<node />"));
+
+ doc.reset();
+ CHECK(!doc.first_child());
+ CHECK_NODE(doc, STR(""));
+}
+
+TEST(document_reset_empty)
+{
+ xml_document doc;
+
+ doc.reset();
+ CHECK(!doc.first_child());
+ CHECK_NODE(doc, STR(""));
+}