diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-04 10:01:16 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-04 10:01:16 +0000 |
commit | 05c651d87f95268823f4f0ed5a9206b5cd734507 (patch) | |
tree | 4439f7fdb0665693ed724fa914c37aac7469ebe3 /tests/test_document.cpp | |
parent | f8c18461e6e6459a4e13c05fb964dddfa810dae0 (diff) |
tests: Added more tests for better code coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@626 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r-- | tests/test_document.cpp | 32 |
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; |