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.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index a2e76b0..e839b2f 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -1,5 +1,7 @@
#include "common.hpp"
+#include <fstream>
+
TEST(document_create)
{
pugi::xml_document doc;
@@ -16,6 +18,17 @@ TEST(document_load_stream)
CHECK_NODE(doc, "<node />");
}
+TEST(document_load_stream_error)
+{
+ pugi::xml_document doc;
+
+ std::ifstream fs1("");
+ CHECK(doc.load(fs1).status == status_io_error);
+
+ std::ifstream fs2("con");
+ CHECK(doc.load(fs2).status == status_io_error);
+}
+
TEST(document_load_string)
{
pugi::xml_document doc;
@@ -46,6 +59,14 @@ TEST(document_load_file_large)
CHECK_NODE(doc, oss.str().c_str());
}
+TEST(document_load_file_error)
+{
+ pugi::xml_document doc;
+
+ CHECK(doc.load_file("").status == status_file_not_found);
+ CHECK(doc.load_file("con").status == status_io_error);
+}
+
TEST_XML(document_save, "<node/>")
{
std::ostringstream oss;