diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-20 17:49:52 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-20 17:49:52 +0000 |
commit | 3d986d2b0dcae25c5248b40f2dde27ed078905ee (patch) | |
tree | 09f6bf55e5268af0a27f4dca4ec82d8f19fbb70d /tests/test_document.cpp | |
parent | a0990f0975e9c241b71b38ced6b7326a28d3218e (diff) |
tests: Added declaration and document load/load_file error tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@157 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r-- | tests/test_document.cpp | 21 |
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;
|