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.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 4a915df..ced06a8 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -126,6 +126,28 @@ TEST(document_load_stream_exceptions)
}
}
#endif
+
+TEST(document_load_stream_error_previous)
+{
+ pugi::xml_document doc;
+ CHECK(doc.load("<node/>"));
+ CHECK(doc.first_child());
+
+ std::ifstream fs1("filedoesnotexist");
+ CHECK(doc.load(fs1).status == status_io_error);
+ CHECK(!doc.first_child());
+}
+
+TEST(document_load_stream_wide_error_previous)
+{
+ pugi::xml_document doc;
+ CHECK(doc.load("<node/>"));
+ CHECK(doc.first_child());
+
+ std::basic_ifstream<wchar_t> fs1("filedoesnotexist");
+ CHECK(doc.load(fs1).status == status_io_error);
+ CHECK(!doc.first_child());
+}
#endif
TEST(document_load_string)
@@ -182,6 +204,16 @@ TEST(document_load_file_error)
CHECK(doc.load_file("tests/data/small.xml").status == status_out_of_memory);
}
+TEST(document_load_file_error_previous)
+{
+ pugi::xml_document doc;
+ CHECK(doc.load("<node/>"));
+ CHECK(doc.first_child());
+
+ CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found);
+ CHECK(!doc.first_child());
+}
+
TEST_XML(document_save, "<node/>")
{
xml_writer_string writer;