From 05c651d87f95268823f4f0ed5a9206b5cd734507 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 4 Aug 2010 10:01:16 +0000 Subject: tests: Added more tests for better code coverage git-svn-id: http://pugixml.googlecode.com/svn/trunk@626 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_document.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/test_document.cpp') 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("")); + 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("")); + CHECK(doc.first_child()); + + std::basic_ifstream 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("")); + CHECK(doc.first_child()); + + CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found); + CHECK(!doc.first_child()); +} + TEST_XML(document_save, "") { xml_writer_string writer; -- cgit v1.2.3