diff options
-rw-r--r-- | tests/test_document.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 1f781e2..abc676e 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -102,6 +102,26 @@ TEST(document_load_stream_wide) CHECK(doc.load(iss)); CHECK_NODE(doc, STR("<node />")); } + +#ifndef PUGIXML_NO_EXCEPTIONS +TEST(document_load_stream_exceptions) +{ + pugi::xml_document doc; + + std::ifstream iss("tests/data/multiline.xml"); + iss.exceptions(std::ios::eofbit); + + try + { + doc.load(iss); + CHECK((bool)!"exception should be thrown"); + } + catch (const std::ios_base::failure&) + { + CHECK(!doc.first_child()); + } +} +#endif #endif TEST(document_load_string) |