From 2ac60c851e351fd69ea8aa8b58ef6953b1792a35 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Thu, 22 Jul 2010 05:09:50 +0000 Subject: tests: Added stream exception test git-svn-id: http://pugixml.googlecode.com/svn/trunk@611 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_document.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') 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("")); } + +#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) -- cgit v1.2.3